Skip to content

Commit bdc7d3a

Browse files
committed
Fix UDP Python 3.5 issues.
Closes: apenwarr#48
1 parent 90654b4 commit bdc7d3a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sshuttle/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def expire_connections(now, mux):
289289
for peer, (chan, timeout) in udp_by_src.items():
290290
if timeout < now:
291291
debug3('expiring UDP channel channel=%d peer=%r\n' % (chan, peer))
292-
mux.send(chan, ssnet.CMD_UDP_CLOSE, '')
292+
mux.send(chan, ssnet.CMD_UDP_CLOSE, b'')
293293
remove.append(peer)
294294
del mux.channels[chan]
295295
for peer in remove:
@@ -335,7 +335,7 @@ def onaccept_tcp(listener, method, mux, handlers):
335335

336336

337337
def udp_done(chan, data, method, sock, dstip):
338-
(src, srcport, data) = data.split(",", 2)
338+
(src, srcport, data) = data.split(b",", 2)
339339
srcip = (src, int(srcport))
340340
debug3('doing send from %r to %r\n' % (srcip, dstip,))
341341
method.send_udp(sock, srcip, dstip, data)
@@ -354,10 +354,10 @@ def onaccept_udp(listener, method, mux, handlers):
354354
chan = mux.next_channel()
355355
mux.channels[chan] = lambda cmd, data: udp_done(
356356
chan, data, method, listener, dstip=srcip)
357-
mux.send(chan, ssnet.CMD_UDP_OPEN, listener.family)
357+
mux.send(chan, ssnet.CMD_UDP_OPEN, b"%d" % listener.family)
358358
udp_by_src[srcip] = chan, now + 30
359359

360-
hdr = "%s,%r," % (dstip[0], dstip[1])
360+
hdr = b"%s,%d," % (dstip[0].encode("ASCII"), dstip[1])
361361
mux.send(chan, ssnet.CMD_UDP_DATA, hdr + data)
362362

363363
expire_connections(now, mux)

0 commit comments

Comments
 (0)