@@ -755,7 +755,7 @@ impl TcpSocket {
755
755
-> future:: Future < result:: Result < ( ) , TcpErrData > > {
756
756
write_future ( & self , raw_write_data)
757
757
}
758
- pub fn getpeername ( ) -> ip:: IpAddr {
758
+ pub fn get_peer_addr ( ) -> ip:: IpAddr {
759
759
unsafe {
760
760
if self . socket_data . ipv6 {
761
761
let addr = uv:: ll:: ip6_addr ( "" , 0 ) ;
@@ -1249,8 +1249,8 @@ mod test {
1249
1249
impl_gl_tcp_ipv4_server_and_client ( ) ;
1250
1250
}
1251
1251
#[ test]
1252
- fn test_gl_tcp_get_peer_name ( ) unsafe {
1253
- impl_gl_tcp_ipv4_get_peer_name ( ) ;
1252
+ fn test_gl_tcp_get_peer_addr ( ) unsafe {
1253
+ impl_gl_tcp_ipv4_get_peer_addr ( ) ;
1254
1254
}
1255
1255
#[ test]
1256
1256
fn test_gl_tcp_ipv4_client_error_connection_refused ( ) unsafe {
@@ -1279,8 +1279,8 @@ mod test {
1279
1279
}
1280
1280
#[ test]
1281
1281
#[ ignore( cfg( target_os = "linux" ) ) ]
1282
- fn test_gl_tcp_get_peer_name ( ) unsafe {
1283
- impl_gl_tcp_ipv4_get_peer_name ( ) ;
1282
+ fn test_gl_tcp_get_peer_addr ( ) unsafe {
1283
+ impl_gl_tcp_ipv4_get_peer_addr ( ) ;
1284
1284
}
1285
1285
#[ test]
1286
1286
#[ ignore( cfg( target_os = "linux" ) ) ]
@@ -1351,7 +1351,7 @@ mod test {
1351
1351
assert str:: contains ( actual_req, expected_req) ;
1352
1352
assert str:: contains ( actual_resp, expected_resp) ;
1353
1353
}
1354
- fn impl_gl_tcp_ipv4_get_peer_name ( ) {
1354
+ fn impl_gl_tcp_ipv4_get_peer_addr ( ) {
1355
1355
let hl_loop = uv:: global_loop:: get ( ) ;
1356
1356
let server_ip = ~"127.0 . 0 . 1 ";
1357
1357
let server_port = 8889 u;
@@ -1387,8 +1387,8 @@ mod test {
1387
1387
let sock = result::unwrap(move connect_result);
1388
1388
1389
1389
// This is what we are actually testing!
1390
- assert net::ip::format_addr(&sock.getpeername ()) == ~" 127 . 0 . 0 . 1 ";
1391
- assert net :: ip:: get_port( & sock. getpeername ( ) ) == 8889 ;
1390
+ assert net::ip::format_addr(&sock.get_peer_addr ()) == ~" 127 . 0 . 0 . 1 ";
1391
+ assert net :: ip:: get_port( & sock. get_peer_addr ( ) ) == 8889 ;
1392
1392
1393
1393
// Fulfill the protocol the test server expects
1394
1394
let resp_bytes = str:: to_bytes ( ~"ping") ;
@@ -1592,8 +1592,11 @@ mod test {
1592
1592
~"SERVER /WORKER : send on cont ch") ;
1593
1593
cont_ch. send ( ( ) ) ;
1594
1594
let sock = result:: unwrap ( move accept_result) ;
1595
+ let peer_addr = sock. get_peer_addr ( ) ;
1595
1596
log ( debug, ~"SERVER : successfully accepted"+
1596
- ~"connection!");
1597
+ fmt ! ( " connection from %s:%u" ,
1598
+ ip:: format_addr( & peer_addr) ,
1599
+ ip:: get_port( & peer_addr) ) ) ;
1597
1600
let received_req_bytes = read ( & sock, 0 u) ;
1598
1601
match move received_req_bytes {
1599
1602
result:: Ok ( move data) => {
0 commit comments