File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
crates/shadowsocks-service/src/server Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -414,11 +414,10 @@ impl UdpAssociationContext {
414
414
let mut buffer = [ 0u8 ; MAXIMUM_UDP_PAYLOAD_SIZE ] ;
415
415
loop {
416
416
let ( n, addr) = match outbound. recv_from ( & mut buffer) . await {
417
- Ok ( ( n, addr) ) => {
418
- trace ! ( "udp relay {} <- {} received {} bytes" , self . peer_addr, addr, n) ;
417
+ Ok ( r) => {
419
418
// Keep association alive in map
420
419
let _ = self . assoc_map . lock ( ) . await . get ( & self . peer_addr ) ;
421
- ( n , addr )
420
+ r
422
421
}
423
422
Err ( err) => {
424
423
error ! (
@@ -430,13 +429,23 @@ impl UdpAssociationContext {
430
429
}
431
430
} ;
432
431
432
+ trace ! ( "udp relay {} <- {} received {} bytes" , self . peer_addr, addr, n) ;
433
+
433
434
let data = & buffer[ ..n] ;
434
435
435
436
let target_addr = match self . target_cache . lock ( ) . await . get ( & addr) {
436
437
Some ( a) => a. clone ( ) ,
437
438
None => Address :: from ( addr) ,
438
439
} ;
439
440
441
+ trace ! (
442
+ "udp relay {} <- {} ({}) with {} bytes" ,
443
+ self . peer_addr,
444
+ target_addr,
445
+ addr,
446
+ data. len( )
447
+ ) ;
448
+
440
449
// Send back to client
441
450
if let Err ( err) = self . inbound . send_to ( self . peer_addr , & target_addr, data) . await {
442
451
warn ! (
You can’t perform that action at this time.
0 commit comments