except Socket.error as serr:
error_msg = "Could not connect to %s:%s. Socket Error #%s: %s"
self.event('socket_error', serr)
log.error(error_msg, self.address[0], self.address[1],
serr.errno, serr.strerror)
self.reconnect_delay = delay
return False
In case socket throws, exception handler will not reset delay but will continue to increase it, that is OK as long as someone uses reattempt=True, but as I set it to False I expect connect() to exit as soon as possible if it can't connect. reattempt=False means - "Do not be smart, just try and return ASAP"
DEBUG:sleekxmpp.xmlstream.xmlstream:Trying to connect to 127.0.0.1:5222
DEBUG:sleekxmpp.xmlstream.xmlstream:Waiting 2.18147447623 seconds before connecting.
DEBUG:sleekxmpp.xmlstream.xmlstream:Connecting to 127.0.0.1:5222
ERROR:sleekxmpp.xmlstream.xmlstream:Could not connect to 127.0.0.1:5222. Socket Error #111: Connection refused
WARNING:sleekxmpp.clientxmpp:No SRV records for us.apica.com
DEBUG:sleekxmpp.xmlstream.xmlstream:Trying to connect to 127.0.0.1:5222
DEBUG:sleekxmpp.xmlstream.xmlstream:Waiting 4.66138583853 seconds before connecting.
DEBUG:sleekxmpp.xmlstream.xmlstream:Connecting to 127.0.0.1:5222
ERROR:sleekxmpp.xmlstream.xmlstream:Could not connect to 127.0.0.1:5222. Socket Error #111: Connection refused
WARNING:sleekxmpp.clientxmpp:No SRV records for us.apica.com
DEBUG:sleekxmpp.xmlstream.xmlstream:Trying to connect to 127.0.0.1:5222
DEBUG:sleekxmpp.xmlstream.xmlstream:Waiting 7.92112134338 seconds before connecting.
I think the way reconnect delay currently handled is not quite right: https://github.com/fritzy/SleekXMPP/blob/master/sleekxmpp/xmlstream/xmlstream.py#L459
In case socket throws, exception handler will not reset delay but will continue to increase it, that is OK as long as someone uses reattempt=True, but as I set it to False I expect connect() to exit as soon as possible if it can't connect. reattempt=False means - "Do not be smart, just try and return ASAP"
Also comment here -> https://github.com/fritzy/SleekXMPP/blob/master/sleekxmpp/xmlstream/xmlstream.py#L358 says that connect() will try every second, I think it is not quite true.