gen_emqtt: stop gen_emqtt when client not connected
Opened this issue · 1 comments
radekg commented
Hi, I'm integrating gen_emqtt
with a custom MQTT client for VerneMQ. The problem I'm facing is that, once I call gen_emqtt:start_link
, when the MQTT broker is not responding (or not there), there is no way to interrupt connection attempts.
Calling gen_emqtt:disconnect(MqttPid)
on a not connected client has no effect. Calling gen_fsm:stop(MqttPid)
gives me:
00:35:57.387 [error] gen_fsm <0.833.0> in state connecting terminated with reason: no function clause matching gen_emqtt:wrap_res({ok}, connecting, {state,"localhost",1883,undefined,1,undefined,undefined,"myclient438Et5T196383Qww",true,undefined,...}) line 131
00:35:57.387 [error] CRASH REPORT Process <0.833.0> with 15 neighbours exited with reason: no function clause matching gen_emqtt:wrap_res({ok}, connecting, {state,"localhost",1883,undefined,1,undefined,undefined,"myclient438Et5T196383Qww",true,undefined,...}) line 131 in gen_fsm:terminate/7 line 547
Is there another function whch would handle this scenario or is the feature not implemented?