@@ -289,7 +289,7 @@ def expire_connections(now, mux):
289
289
for peer , (chan , timeout ) in udp_by_src .items ():
290
290
if timeout < now :
291
291
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 '' )
293
293
remove .append (peer )
294
294
del mux .channels [chan ]
295
295
for peer in remove :
@@ -335,7 +335,7 @@ def onaccept_tcp(listener, method, mux, handlers):
335
335
336
336
337
337
def udp_done (chan , data , method , sock , dstip ):
338
- (src , srcport , data ) = data .split ("," , 2 )
338
+ (src , srcport , data ) = data .split (b "," , 2 )
339
339
srcip = (src , int (srcport ))
340
340
debug3 ('doing send from %r to %r\n ' % (srcip , dstip ,))
341
341
method .send_udp (sock , srcip , dstip , data )
@@ -354,10 +354,10 @@ def onaccept_udp(listener, method, mux, handlers):
354
354
chan = mux .next_channel ()
355
355
mux .channels [chan ] = lambda cmd , data : udp_done (
356
356
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 )
358
358
udp_by_src [srcip ] = chan , now + 30
359
359
360
- hdr = "%s,%r ," % (dstip [0 ], dstip [1 ])
360
+ hdr = b "%s,%d ," % (dstip [0 ]. encode ( "ASCII" ) , dstip [1 ])
361
361
mux .send (chan , ssnet .CMD_UDP_DATA , hdr + data )
362
362
363
363
expire_connections (now , mux )
0 commit comments