[sgala] IPV6 support for connection fith server. see #1969

This commit is contained in:
Yann Leboulanger 2006-11-25 11:50:31 +00:00
parent e8145b8b31
commit a37b946098
3 changed files with 27 additions and 13 deletions

View File

@ -1,8 +1,9 @@
Gajim 0.11 (XX October 2006) Gajim 0.11 (XX December 2006)
* New build system, using GNU autotools. See README.html * New build system, using GNU autotools. See README.html
* Support for link-local messaging via Zeroconf using Avahi (XEP-0174) * Support for link-local messaging via Zeroconf using Avahi (XEP-0174)
* Automatically connect and disconnect to accounts according to network availability (if Network Manager is present) * Automatically connect and disconnect to accounts according to network availability (if Network Manager is present)
* GNOME Keyring Support (if GNOME keyring is available, manage passwords and save them in an encrypted file). * IPV6 support to connect to server
* GNOME Keyring Support (if GNOME keyring is available, manage passwords and save them in an encrypted file)
* Introducing View Menu (GNOME HIG) * Introducing View Menu (GNOME HIG)
* Ability to now hide the Transports group * Ability to now hide the Transports group
* Support for notify-python. So if notification-daemon is not available, we still can show cool popups * Support for notify-python. So if notification-daemon is not available, we still can show cool popups
@ -33,8 +34,8 @@ Gajim 0.11 (XX October 2006)
* Fixed bugs when removing or renaming an account with tabs open (#2369 and #2370) * Fixed bugs when removing or renaming an account with tabs open (#2369 and #2370)
* New translations: Croatian, Esperanto * New translations: Croatian, Esperanto
* FIXME : Ad-Hoc for 0.11 ? * Ad-Hoc commands
* FIXME : does that work ? not tested : Metacontacts across accounts (#1596) * Metacontacts across accounts (#1596)
* Gajim now requires Python 2.4 to run * Gajim now requires Python 2.4 to run
Gajim 0.10.1 (06 June 2006) Gajim 0.10.1 (06 June 2006)

View File

@ -95,13 +95,17 @@ class TCPsocket(PlugIn):
def connect(self,server=None): def connect(self,server=None):
""" Try to connect. Returns non-empty string on success. """ """ Try to connect. Returns non-empty string on success. """
try: try:
if not server: server=self._server if not server:
self._sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM) server=self._server
self._sock.connect(server) for ai in socket.getaddrinfo(server[0],server[1],socket.AF_UNSPEC,socket.SOCK_STREAM):
try:
self._sock=socket.socket(*ai[:3])
self._sock.connect(ai[4])
self._send=self._sock.sendall self._send=self._sock.sendall
self._recv=self._sock.recv self._recv=self._sock.recv
self.DEBUG("Successfully connected to remote host %s"%`server`,'start') self.DEBUG("Successfully connected to remote host %s"%`server`,'start')
return 'ok' return 'ok'
except: continue
except: pass except: pass
def plugout(self): def plugout(self):

View File

@ -106,8 +106,17 @@ class NonBlockingTcp(PlugIn, IdleObject):
self._server = server self._server = server
self.state = 0 self.state = 0
try: try:
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) for ai in socket.getaddrinfo(server[0],server[1],socket.AF_UNSPEC,socket.SOCK_STREAM):
try:
self._sock=socket.socket(*ai[:3])
self._sock.setblocking(False) self._sock.setblocking(False)
self._server=ai[4]
break
except:
if sys.exc_value[0] == errno.EINPROGRESS:
break
#for all errors, we try other addresses
continue
except: except:
sys.exc_clear() sys.exc_clear()
if self.on_connect_failure: if self.on_connect_failure: