Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnection-Callback while stopping broker gracefully #60

Closed
karanparmar26 opened this issue Jan 18, 2018 · 6 comments
Closed

Disconnection-Callback while stopping broker gracefully #60

karanparmar26 opened this issue Jan 18, 2018 · 6 comments

Comments

@karanparmar26
Copy link

Hello,

I am just trying to get a disconnection callback when connected broker is stopped gracefully,
current sdk is working perfectly in the case of disconnection callback, when network connectivity goes,
but if the connected broker is stopped, in that case sdk immidiately terminates.

correct me if i am doing something wrong.

@vareddy-zz
Copy link
Contributor

vareddy-zz commented Jan 18, 2018

Hi @karanparmar26,
Thank you for your interest in AWS IoT!
When you say connected broker, do you mean the Greengrass Core or any other MQTT broker? Also are you connecting over OpenSSL, mbedTLS or WebSockets?
Thanks!
Varun

@karanparmar26
Copy link
Author

karanparmar26 commented Jan 19, 2018

Yes, i am connecting to some other mqtt broker over openSSL.
And when i am stopping that broker service, sdk terminates immidiately.

@vareddy-zz
Copy link
Contributor

Hi @karanparmar26,
I have been able to reproduce the issue and have a potential fix for it.
Could you modify the OpenSSLConnection.cpp header file and add this line after the line indicated:
signal(SIGPIPE, SIG_IGN);
Please try the above and let us know if that works in your case.
Thanks!
Varun

@karanparmar26
Copy link
Author

Hi @vareddy

Yes i updated the OpenSSLConnection.cpp as you mentioned, and it worked.
Now i am successfully able to get a disconnection callback, when the broker is stopped gracefully.

Thanks!
Karan

@vareddy-zz
Copy link
Contributor

Hi @karanparmar26,
That's great! I'll test the fix more on our end and publish a fix to master after we complete our testing. I'll keep this issue open till I publish the fix.
Thanks!
Varun

@vareddy-zz
Copy link
Contributor

Hi @karanparmar26,
I've pushed the fix to master. I moved the signal ignore code into the init function as it needs to be called only once. Please update your code if required.
Thanks!
Varun

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

No branches or pull requests

2 participants