Skip to content

Commit 2be1f16

Browse files
Merge pull request #3076 from rabbitmq/web-mqtt-fd-limit
Make Web-MQTT obtain/release a FD via file_handle_cache
2 parents 2a217f0 + d948097 commit 2be1f16

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

deps/rabbitmq_web_mqtt/src/rabbit_web_mqtt_handler.erl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ init(Req, Opts) ->
7979
}, WsOpts}.
8080

8181
websocket_init(State0 = #state{socket = Sock, peername = PeerAddr}) ->
82+
ok = file_handle_cache:obtain(),
8283
case rabbit_net:connection_string(Sock, inbound) of
8384
{ok, ConnStr} ->
8485
State = State0#state{
@@ -236,6 +237,7 @@ stop(State) ->
236237
stop(State, 1000, "MQTT died").
237238

238239
stop(State, CloseCode, Error0) ->
240+
ok = file_handle_cache:release(),
239241
stop_rabbit_mqtt_processor(State),
240242
Error1 = rabbit_data_coercion:to_binary(Error0),
241243
{[{close, CloseCode, Error1}], State}.

deps/rabbitmq_web_mqtt_examples/priv/echo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<link href="main.css" rel="stylesheet" type="text/css"/>
4646
</head>
4747
<body lang="en">
48-
<h1>RabbitMQ Web MQTT Example</h1>
48+
<h1><a href="index.html">RabbitMQ Web MQTT Examples</a> > Echo Server</h1>
4949

5050
<div id="first" class="box">
5151
<h2>Received</h2>

0 commit comments

Comments
 (0)