commit
770fbcdae6
|
@ -79,11 +79,12 @@ init([OriginConn, MqttEnv]) ->
|
||||||
exit({shutdown, Reason})
|
exit({shutdown, Reason})
|
||||||
end,
|
end,
|
||||||
ConnName = esockd_net:format(PeerName),
|
ConnName = esockd_net:format(PeerName),
|
||||||
|
Self = self(),
|
||||||
SendFun = fun(Data) ->
|
SendFun = fun(Data) ->
|
||||||
try Connection:async_send(Data) of
|
try Connection:async_send(Data) of
|
||||||
true -> ok
|
true -> ok
|
||||||
catch
|
catch
|
||||||
error:Error -> exit({shutdown, Error})
|
error:Error -> Self ! {shutdown, Error}
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
PktOpts = proplists:get_value(packet, MqttEnv),
|
PktOpts = proplists:get_value(packet, MqttEnv),
|
||||||
|
@ -138,6 +139,10 @@ handle_cast(Msg, State) ->
|
||||||
handle_info(timeout, State) ->
|
handle_info(timeout, State) ->
|
||||||
shutdown(idle_timeout, State);
|
shutdown(idle_timeout, State);
|
||||||
|
|
||||||
|
%% fix issue #535
|
||||||
|
handle_info({shutdown, Error}, State) ->
|
||||||
|
shutdown(Error, State);
|
||||||
|
|
||||||
%% Asynchronous SUBACK
|
%% Asynchronous SUBACK
|
||||||
handle_info({suback, PacketId, GrantedQos}, State) ->
|
handle_info({suback, PacketId, GrantedQos}, State) ->
|
||||||
with_proto_state(fun(ProtoState) ->
|
with_proto_state(fun(ProtoState) ->
|
||||||
|
|
Loading…
Reference in New Issue