Skip to content
This repository was archived by the owner on Nov 16, 2020. It is now read-only.

Commit d7ec2a4

Browse files
committed
Remove the credit/conserve resources for now
I can't throttle the Websocket connection with the current Cowboy interface.
1 parent 5638a54 commit d7ec2a4

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

src/rabbit_web_mqtt_handler.erl

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
-export([websocket_info/3]).
2323
-export([websocket_terminate/3]).
2424

25-
-export([conserve_resources/3]).
26-
2725
-include_lib("amqp_client/include/amqp_client.hrl").
2826

2927
-record(state, {
@@ -44,15 +42,12 @@ websocket_init(_, Req, Opts) ->
4442
case rabbit_net:connection_string(Sock, inbound) of
4543
{ok, ConnStr} ->
4644
rabbit_log:log(connection, info, "accepting WEB-MQTT connection ~p (~s)~n", [self(), ConnStr]),
47-
rabbit_alarm:register(
48-
self(), {?MODULE, conserve_resources, []}),
4945
ProcessorState = rabbit_mqtt_processor:initial_state(Sock,
5046
rabbit_mqtt_reader:ssl_login_name(Sock),
5147
fun send_reply/2),
5248
{SecWsProtocol, Req1} = cowboy_req:header(<<"sec-websocket-protocol">>, Req),
5349
Req2 = cowboy_req:set_resp_header(<<"sec-websocket-protocol">>, SecWsProtocol, Req1),
5450
Req3 = cowboy_req:compact(Req2),
55-
%% @todo control_throttle
5651
{ok, Req3, #state{
5752
conn_name = ConnStr,
5853
keepalive = {none, none},
@@ -116,9 +111,6 @@ websocket_info(keepalive_timeout, Req, State = #state {conn_name = ConnStr,
116111
rabbit_mqtt_processor:send_will(PState),
117112
{shutdown, Req, State};
118113

119-
%% @todo conserve_resources
120-
%% @todo bump_credit
121-
122114
websocket_info(Msg, Req, State) ->
123115
rabbit_log:log(connection, info, "WEB-MQTT: unexpected message ~p~n",
124116
[Msg]),
@@ -132,10 +124,6 @@ websocket_terminate(_, _, #state{ proc_state = ProcState,
132124
websocket_terminate(_, _, _) ->
133125
ok.
134126

135-
conserve_resources(Pid, _, Conserve) ->
136-
Pid ! {conserve_resources, Conserve},
137-
ok.
138-
139127
%% Internal.
140128

141129
handle_data(<<>>, Req, State) ->
@@ -145,7 +133,6 @@ handle_data(Data, Req, State = #state{ parse_state = ParseState,
145133
conn_name = ConnStr }) ->
146134
case rabbit_mqtt_frame:parse(Data, ParseState) of
147135
{more, ParseState1} ->
148-
%% @todo control_throttle
149136
{ok, Req, State #state{ parse_state = ParseState1 }, hibernate};
150137
{ok, Frame, Rest} ->
151138
case rabbit_mqtt_processor:process_frame(Frame, ProcState) of

0 commit comments

Comments
 (0)