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

socket leakage #304

Closed
robustor123 opened this Issue Nov 7, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@robustor123

when reconnect is needed, previous socket is not closed.
as following modification, the _mosquitto_socket_close() function should be called.
with this fix, I can remove socket leakage problem in mosquitto library.

static int _mosquitto_reconnect(struct mosquitto *mosq, bool blocking)
{
...
#ifdef WITH_SOCKS
if(mosq->socks5_host){
rc = _mosquitto_socket_connect(mosq, mosq->socks5_host, mosq->socks5_port, mosq->bind_address, blocking);
}else
#endif
{
if(mosq->sock != INVALID_SOCKET){
_mosquitto_socket_close(mosq); //close socket
}
rc = _mosquitto_socket_connect(mosq, mosq->host, mosq->port, mosq->bind_address, blocking);
}

@thlassche

This comment has been minimized.

Show comment
Hide comment
@thlassche

thlassche Nov 7, 2016

Contributor

Pull request opened for this #307

Contributor

thlassche commented Nov 7, 2016

Pull request opened for this #307

thlassche added a commit to thlassche/mosquitto that referenced this issue Nov 7, 2016

Fix #304 Socket leakage
Signed-off-by: Teun Lassche <contact@thlassche.nl>

ralight added a commit that referenced this issue Dec 4, 2016

Fix #304 Socket leakage
Signed-off-by: Teun Lassche <contact@thlassche.nl>

@ralight ralight added this to the fixes-next milestone Dec 4, 2016

@ralight

This comment has been minimized.

Show comment
Hide comment
@ralight

ralight Dec 4, 2016

Contributor

Thanks both, this is now fixed in the fixes branch.

Contributor

ralight commented Dec 4, 2016

Thanks both, this is now fixed in the fixes branch.

@ralight ralight closed this Dec 4, 2016

ralight added a commit that referenced this issue Feb 20, 2017

Fix #304 Socket leakage
Signed-off-by: Teun Lassche <contact@thlassche.nl>

ralight added a commit that referenced this issue Feb 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment