[Python 3]: Removed deprecated tuple unpacking.

This commit is contained in:
Dorian 2013-08-13 17:57:59 -04:00
parent 3bad2a13be
commit a77054d632
2 changed files with 15 additions and 9 deletions

View File

@ -691,17 +691,17 @@ class Transport (threading.Thread):
"""
return self.open_channel('auth-agent@openssh.com')
def open_forwarded_tcpip_channel(self, (src_addr, src_port), (dest_addr, dest_port)):
def open_forwarded_tcpip_channel(self, src, dest):
"""
Request a new channel back to the client, of type C{"forwarded-tcpip"}.
This is used after a client has requested port forwarding, for sending
incoming connections back to the client.
@param src_addr: originator's address
@param src_port: originator's port
@param dest_addr: local (server) connected address
@param dest_port: local (server) connected port
@param src: tuple of the originator (address, port)
@param dest: tuple of the local (server) connected (address, port)
"""
src_addr, src_port = src
dest_addr, dest_port = dest
return self.open_channel('forwarded-tcpip', (dest_addr, dest_port), (src_addr, src_port))
def open_channel(self, kind, dest_addr=None, src_addr=None):
@ -811,7 +811,9 @@ class Transport (threading.Thread):
if port == 0:
port = response.get_int()
if handler is None:
def default_handler(channel, (src_addr, src_port), (dest_addr, dest_port)):
def default_handler(channel, src, dest):
src_addr, src_port = src
dest_addr, dest_port = dest
self._queue_incoming_channel(channel)
handler = default_handler
self._tcp_handler = handler
@ -1511,7 +1513,8 @@ class Transport (threading.Thread):
# only called if a channel has turned on x11 forwarding
if handler is None:
# by default, use the same mechanism as accept()
def default_handler(channel, (src_addr, src_port)):
def default_handler(channel, src):
src_addr, src_port = src
self._queue_incoming_channel(channel)
self._x11_handler = default_handler
else:

View File

@ -444,7 +444,8 @@ class TransportTest(ParamikoTest):
schan = self.ts.accept(1.0)
requested = []
def handler(c, (addr, port)):
def handler(c, remote):
addr, port = remote
requested.append((addr, port))
self.tc._queue_incoming_channel(c)
@ -479,7 +480,9 @@ class TransportTest(ParamikoTest):
schan = self.ts.accept(1.0)
requested = []
def handler(c, (origin_addr, origin_port), (server_addr, server_port)):
def handler(c, origin, server):
origin_addr, origin_port = origin
server_addr, server_port = server
requested.append((origin_addr, origin_port))
requested.append((server_addr, server_port))
self.tc._queue_incoming_channel(c)