Browse Source

as_unspecified → to_unspecified

whitequark 7 years ago
parent
commit
d422f45ac2
2 changed files with 4 additions and 3 deletions
  1. 1 1
      src/socket/tcp.rs
  2. 3 2
      src/wire/ip.rs

+ 1 - 1
src/socket/tcp.rs

@@ -393,7 +393,7 @@ impl<'a> TcpSocket<'a> {
         // but without committing to a specific address right away.
         let local_addr = match remote_endpoint.addr {
             IpAddress::Unspecified => return Err(()),
-            _ => remote_endpoint.addr.as_unspecified(),
+            _ => remote_endpoint.addr.to_unspecified(),
         };
         let local_endpoint = IpEndpoint { addr: local_addr, ..local_endpoint };
 

+ 3 - 2
src/wire/ip.rs

@@ -73,7 +73,7 @@ impl Address {
     }
 
     /// Return an unspecified address that has the same IP version as `self`.
-    pub fn as_unspecified(&self) -> Address {
+    pub fn to_unspecified(&self) -> Address {
         match self {
             &Address::Unspecified => Address::Unspecified,
             // &Address::Ipv4 => Address::Ipv4(Ipv4Address::UNSPECIFIED),
@@ -353,7 +353,8 @@ pub mod checksum {
                 ])
             },
 
-            _ => panic!("Unexpected pseudo header ")
+            _ => panic!("Unexpected pseudo header addresses: {}, {}",
+                        src_addr, dst_addr)
         }
     }
 }