about summary refs log tree commit diff
path: root/src/libstd/net_tcp.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-01-28 14:41:20 -0800
committerBrian Anderson <banderson@mozilla.com>2013-01-28 14:41:20 -0800
commitd9170e14b1c1c56f37821e96d4d24d5687dc3374 (patch)
treeccdd2f1f8814bfecf70bdaa6a56b9a49148e81f6 /src/libstd/net_tcp.rs
parentd38939c7e8ca67a3991949cb17bf052b840d1aa4 (diff)
downloadrust-d9170e14b1c1c56f37821e96d4d24d5687dc3374.tar.gz
rust-d9170e14b1c1c56f37821e96d4d24d5687dc3374.zip
Tidy
Diffstat (limited to 'src/libstd/net_tcp.rs')
-rw-r--r--src/libstd/net_tcp.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs
index b75ddebac8f..608723a6ca5 100644
--- a/src/libstd/net_tcp.rs
+++ b/src/libstd/net_tcp.rs
@@ -809,7 +809,9 @@ fn listen_common(host_ip: ip::IpAddr, port: uint, backlog: uint,
  * A buffered wrapper that you can cast as an `io::reader` or `io::writer`
  */
 pub fn socket_buf(sock: TcpSocket) -> TcpSocketBuf {
-    TcpSocketBuf(@TcpBufferedSocketData { sock: move sock, mut buf: ~[], buf_off: 0 })
+    TcpSocketBuf(@TcpBufferedSocketData {
+        sock: move sock, mut buf: ~[], buf_off: 0
+    })
 }
 
 /// Convenience methods extending `net::tcp::tcp_socket`
@@ -865,19 +867,19 @@ impl TcpSocketBuf: io::Reader {
         loop {
           assert count < len;
 
-          // If possible, copy up to `len` bytes from the internal 
+          // If possible, copy up to `len` bytes from the internal
           // `data.buf` into `buf`
           let nbuffered = self.data.buf.len() - self.data.buf_off;
           let needed = len - count;
             if nbuffered > 0 {
                 unsafe {
-                    let ncopy = uint::min(nbuffered, needed); 
+                    let ncopy = uint::min(nbuffered, needed);
                     let dst = ptr::mut_offset(
                         vec::raw::to_mut_ptr(buf), count);
                     let src = ptr::const_offset(
                         vec::raw::to_const_ptr(self.data.buf),
                         self.data.buf_off);
-                    ptr::copy_memory(dst, src, ncopy); 
+                    ptr::copy_memory(dst, src, ncopy);
                     self.data.buf_off += ncopy;
                     count += ncopy;
                 }
@@ -905,7 +907,7 @@ impl TcpSocketBuf: io::Reader {
                          err_data.err_name, err_data.err_msg);
                   // As we have already copied data into result buffer,
                   // we cannot simply return 0 here. Instead the error
-                  // should show up in a later call to read(). 
+                  // should show up in a later call to read().
                   break;
               }
           }
@@ -1872,7 +1874,8 @@ pub mod test {
                         cont_ch.send(());
                         let sock = result::unwrap(move accept_result);
                         let peer_addr = sock.get_peer_addr();
-                        debug!("SERVER: successfully accepted connection from %s:%u",
+                        debug!("SERVER: successfully accepted \
+                                connection from %s:%u",
                                  ip::format_addr(&peer_addr),
                                  ip::get_port(&peer_addr));
                         let received_req_bytes = read(&sock, 0u);