@@ -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
337337def 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