Skip to content

Commit d1d7ecf

Browse files
STOMP reader state: naming
(cherry picked from commit 5978c15f4ceac0b1965bcce5017766a23987a2af)
1 parent 1031271 commit d1d7ecf

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

deps/rabbitmq_stomp/src/rabbit_stomp_reader.erl

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,24 @@
2424
-define(OTHER_METRICS, [recv_cnt, send_cnt, send_pend, garbage_collection, state,
2525
timeout]).
2626

27-
-record(reader_state, {socket, conn_name, parse_state, processor_state, state,
28-
conserve_resources, recv_outstanding, max_frame_size, frame_length,
29-
stats_timer, parent, connection, heartbeat_sup, heartbeat,
30-
timeout_sec %% heartbeat timeout value used, 0 means
31-
%% heartbeats are disabled
32-
}).
27+
-record(reader_state, {
28+
socket,
29+
conn_name,
30+
parse_state,
31+
processor_state,
32+
state,
33+
conserve_resources,
34+
recv_outstanding,
35+
max_frame_size,
36+
current_frame_size,
37+
stats_timer,
38+
parent,
39+
connection,
40+
heartbeat_sup, heartbeat,
41+
%% heartbeat timeout value used, 0 means
42+
%% heartbeats are disabled
43+
timeout_sec
44+
}).
3345

3446
%%----------------------------------------------------------------------------
3547

@@ -82,7 +94,7 @@ init([SupHelperPid, Ref, Configuration]) ->
8294
heartbeat_sup = SupHelperPid,
8395
heartbeat = {none, none},
8496
max_frame_size = MaxFrameSize,
85-
frame_length = 0,
97+
current_frame_size = 0,
8698
state = running,
8799
conserve_resources = false,
88100
recv_outstanding = false})), #reader_state.stats_timer),
@@ -226,7 +238,7 @@ process_received_bytes([], State) ->
226238
process_received_bytes(Bytes,
227239
State = #reader_state{
228240
max_frame_size = MaxFrameSize,
229-
frame_length = FrameLength,
241+
current_frame_size = FrameLength,
230242
processor_state = ProcState,
231243
parse_state = ParseState}) ->
232244
case rabbit_stomp_frame:parse(Bytes, ParseState) of
@@ -238,7 +250,7 @@ process_received_bytes(Bytes,
238250
{stop, normal, State};
239251
false ->
240252
{ok, State#reader_state{parse_state = ParseState1,
241-
frame_length = FrameLength1}}
253+
current_frame_size = FrameLength1}}
242254
end;
243255
{ok, Frame, Rest} ->
244256
FrameLength1 = FrameLength + byte_size(Bytes) - byte_size(Rest),
@@ -252,7 +264,7 @@ process_received_bytes(Bytes,
252264
PS = rabbit_stomp_frame:initial_state(),
253265
NextState = maybe_block(State, Frame),
254266
process_received_bytes(Rest, NextState#reader_state{
255-
frame_length = 0,
267+
current_frame_size = 0,
256268
processor_state = NewProcState,
257269
parse_state = PS,
258270
connection = Conn});

0 commit comments

Comments
 (0)