Skip to content
This repository has been archived by the owner on Sep 13, 2021. It is now read-only.

gen_emqtt: stop gen_emqtt when client not connected #14

Open
radekg opened this issue Aug 20, 2016 · 1 comment
Open

gen_emqtt: stop gen_emqtt when client not connected #14

radekg opened this issue Aug 20, 2016 · 1 comment

Comments

@radekg
Copy link
Contributor

radekg commented Aug 20, 2016

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?

@radekg
Copy link
Contributor Author

radekg commented Aug 20, 2016

Created a PR which seems to be acting correctly for a not connected client. Calling disconnect in connecting state causes the FSM to stop.
#15

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant