[Trunk]
- In verbose mode, print encodings. (Especially for Windows users who don't have Python) (gajim.py) - Attempt at fixing traceback when getting user's home directory in Windows. See #2812. (c/configpaths.py) - Show 'error' icon next to account while waiting for reconnect. Fixes #2786. (c/connection_handlers.py, c/gajim.py, c/connection.py) [PyOpenSSL] - Fix 100% CPU usage and hanging connection when server closes connection on us. (c/x/transports_nb.py) - Fix 'hanging' connection when server closes the connection on us before we can open the XML stream. (Disconnect handler didn't get called.) (c/x/client_nb.py) - Change prints to logger calls, various enhancements to debug printing, reduce spam (c/x/transports_nb.py) - this → self (c/x/transports_nb.py) - Call _do_receive() once to collect error message from socket, when error flag is raised in scheduler. (c/x/transports_nb.py)
This commit is contained in:
parent
4fe582151a
commit
a4655276fe
|
@ -369,4 +369,10 @@
|
||||||
<item jid="xmpp.us" name="">
|
<item jid="xmpp.us" name="">
|
||||||
<active port="5222"/>
|
<active port="5222"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item jid="zloygod.serveftp.com" name="Rituko's server">
|
||||||
|
<active port="5222"/>
|
||||||
|
</item>
|
||||||
|
<item jid="localhost" name="Localhost">
|
||||||
|
<active port="5222"/>
|
||||||
|
</item>
|
||||||
</query>
|
</query>
|
|
@ -87,7 +87,7 @@ def init():
|
||||||
paths.add_from_root(n, p)
|
paths.add_from_root(n, p)
|
||||||
|
|
||||||
paths.add('DATA', os.path.join(u'..', windowsify(u'data')))
|
paths.add('DATA', os.path.join(u'..', windowsify(u'data')))
|
||||||
paths.add('HOME', os.path.expanduser(u'~'))
|
paths.add('HOME', fse(os.path.expanduser('~')))
|
||||||
paths.add('TMP', fse(tempfile.gettempdir()))
|
paths.add('TMP', fse(tempfile.gettempdir()))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -109,6 +109,8 @@ class Connection(ConnectionHandlers):
|
||||||
self.time_to_reconnect = None
|
self.time_to_reconnect = None
|
||||||
if self.connected < 2: #connection failed
|
if self.connected < 2: #connection failed
|
||||||
gajim.log.debug('reconnect')
|
gajim.log.debug('reconnect')
|
||||||
|
self.connected = 1
|
||||||
|
self.dispatch('STATUS', 'connecting')
|
||||||
self.retrycount += 1
|
self.retrycount += 1
|
||||||
signed = self.get_signed_msg(self.status)
|
signed = self.get_signed_msg(self.status)
|
||||||
self.on_connect_auth = self._init_roster
|
self.on_connect_auth = self._init_roster
|
||||||
|
@ -143,8 +145,8 @@ class Connection(ConnectionHandlers):
|
||||||
if not self.on_purpose:
|
if not self.on_purpose:
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
if gajim.config.get_per('accounts', self.name, 'autoreconnect'):
|
if gajim.config.get_per('accounts', self.name, 'autoreconnect'):
|
||||||
self.connected = 1
|
self.connected = -1
|
||||||
self.dispatch('STATUS', 'connecting')
|
self.dispatch('STATUS', 'error')
|
||||||
# this check has moved from _reconnect method
|
# this check has moved from _reconnect method
|
||||||
# do exponential backoff until 15 minutes,
|
# do exponential backoff until 15 minutes,
|
||||||
# then small linear increase
|
# then small linear increase
|
||||||
|
@ -154,7 +156,7 @@ class Connection(ConnectionHandlers):
|
||||||
self.last_time_to_reconnect *= 1.5
|
self.last_time_to_reconnect *= 1.5
|
||||||
self.last_time_to_reconnect += randomsource.randint(0, 5)
|
self.last_time_to_reconnect += randomsource.randint(0, 5)
|
||||||
self.time_to_reconnect = int(self.last_time_to_reconnect)
|
self.time_to_reconnect = int(self.last_time_to_reconnect)
|
||||||
gajim.log.debug("Reconnect to %s in %ss", self.name, self.time_to_reconnect)
|
gajim.log.info("Reconnect to %s in %ss", self.name, self.time_to_reconnect)
|
||||||
gajim.idlequeue.set_alarm(self._reconnect_alarm,
|
gajim.idlequeue.set_alarm(self._reconnect_alarm,
|
||||||
self.time_to_reconnect)
|
self.time_to_reconnect)
|
||||||
elif self.on_connect_failure:
|
elif self.on_connect_failure:
|
||||||
|
@ -379,11 +381,13 @@ class Connection(ConnectionHandlers):
|
||||||
if self.on_connect_success == self._on_new_account:
|
if self.on_connect_success == self._on_new_account:
|
||||||
con.RegisterDisconnectHandler(self._on_new_account)
|
con.RegisterDisconnectHandler(self._on_new_account)
|
||||||
|
|
||||||
|
gajim.log.info("Connecting to %s: [%s:%d]", self.name, host['host'], host['port'])
|
||||||
con.connect((host['host'], host['port']), proxy = self._proxy,
|
con.connect((host['host'], host['port']), proxy = self._proxy,
|
||||||
secure = self._secure)
|
secure = self._secure)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if not retry and self.retrycount == 0:
|
if not retry and self.retrycount == 0:
|
||||||
|
gajim.log.error("Out of hosts, giving up connecting to %s", self.name)
|
||||||
self.time_to_reconnect = None
|
self.time_to_reconnect = None
|
||||||
if self.on_connect_failure:
|
if self.on_connect_failure:
|
||||||
self.on_connect_failure()
|
self.on_connect_failure()
|
||||||
|
|
|
@ -38,7 +38,7 @@ from common.commands import ConnectionCommands
|
||||||
from common.pubsub import ConnectionPubSub
|
from common.pubsub import ConnectionPubSub
|
||||||
|
|
||||||
STATUS_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd',
|
STATUS_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd',
|
||||||
'invisible']
|
'invisible', 'error']
|
||||||
# kind of events we can wait for an answer
|
# kind of events we can wait for an answer
|
||||||
VCARD_PUBLISHED = 'vcard_published'
|
VCARD_PUBLISHED = 'vcard_published'
|
||||||
VCARD_ARRIVED = 'vcard_arrived'
|
VCARD_ARRIVED = 'vcard_arrived'
|
||||||
|
|
|
@ -121,7 +121,7 @@ sleeper_state = {} # whether we pass auto away / xa or not
|
||||||
status_before_autoaway = {}
|
status_before_autoaway = {}
|
||||||
|
|
||||||
SHOW_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd',
|
SHOW_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd',
|
||||||
'invisible']
|
'invisible', 'error']
|
||||||
|
|
||||||
# zeroconf account name
|
# zeroconf account name
|
||||||
ZEROCONF_ACC_NAME = 'Local'
|
ZEROCONF_ACC_NAME = 'Local'
|
||||||
|
|
|
@ -2157,6 +2157,10 @@ if __name__ == '__main__':
|
||||||
# ^C exits the application normally to delete pid file
|
# ^C exits the application normally to delete pid file
|
||||||
signal.signal(signal.SIGINT, sigint_cb)
|
signal.signal(signal.SIGINT, sigint_cb)
|
||||||
|
|
||||||
|
if gajim.verbose:
|
||||||
|
print >> sys.stderr, "Encodings: d:%s, fs:%s, p:%s" % \
|
||||||
|
(sys.getdefaultencoding(), sys.getfilesystemencoding(), locale.getpreferredencoding())
|
||||||
|
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
# Session Management support
|
# Session Management support
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue