Skip to content

Commit 9555ee7

Browse files
luqmanabrson
authored andcommitted
std: rename getpeername to get_peer_addr
1 parent 781f8cb commit 9555ee7

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/libstd/net_tcp.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ impl TcpSocket {
755755
-> future::Future<result::Result<(), TcpErrData>> {
756756
write_future(&self, raw_write_data)
757757
}
758-
pub fn getpeername() -> ip::IpAddr {
758+
pub fn get_peer_addr() -> ip::IpAddr {
759759
unsafe {
760760
if self.socket_data.ipv6 {
761761
let addr = uv::ll::ip6_addr("", 0);
@@ -1249,8 +1249,8 @@ mod test {
12491249
impl_gl_tcp_ipv4_server_and_client();
12501250
}
12511251
#[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();
12541254
}
12551255
#[test]
12561256
fn test_gl_tcp_ipv4_client_error_connection_refused() unsafe {
@@ -1279,8 +1279,8 @@ mod test {
12791279
}
12801280
#[test]
12811281
#[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();
12841284
}
12851285
#[test]
12861286
#[ignore(cfg(target_os = "linux"))]
@@ -1351,7 +1351,7 @@ mod test {
13511351
assert str::contains(actual_req, expected_req);
13521352
assert str::contains(actual_resp, expected_resp);
13531353
}
1354-
fn impl_gl_tcp_ipv4_get_peer_name() {
1354+
fn impl_gl_tcp_ipv4_get_peer_addr() {
13551355
let hl_loop = uv::global_loop::get();
13561356
let server_ip = ~"127.0.0.1";
13571357
let server_port = 8889u;
@@ -1387,8 +1387,8 @@ mod test {
13871387
let sock = result::unwrap(move connect_result);
13881388
13891389
// 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;
13921392

13931393
// Fulfill the protocol the test server expects
13941394
let resp_bytes = str::to_bytes(~"ping");
@@ -1592,8 +1592,11 @@ mod test {
15921592
~"SERVER/WORKER: send on cont ch");
15931593
cont_ch.send(());
15941594
let sock = result::unwrap(move accept_result);
1595+
let peer_addr = sock.get_peer_addr();
15951596
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)));
15971600
let received_req_bytes = read(&sock, 0u);
15981601
match move received_req_bytes {
15991602
result::Ok(move data) => {

0 commit comments

Comments
 (0)