@@ -128,7 +128,7 @@ enum TcpConnectErrData {
128
128
* the remote host. In the event of failure, a
129
129
* `net::tcp::tcp_connect_err_data` instance will be returned
130
130
*/
131
- fn connect ( - input_ip : ip:: IpAddr , port : uint ,
131
+ fn connect ( + input_ip : ip:: IpAddr , port : uint ,
132
132
iotask : IoTask )
133
133
-> result:: Result < TcpSocket , TcpConnectErrData > unsafe {
134
134
let result_po = core:: comm:: Port :: < ConnAttempt > ( ) ;
@@ -261,7 +261,7 @@ fn connect(-input_ip: ip::IpAddr, port: uint,
261
261
* A `result` object with a `nil` value as the `ok` variant, or a
262
262
* `tcp_err_data` value as the `err` variant
263
263
*/
264
- fn write( sock: TcpSocket , raw_write_data: ~[ u8] )
264
+ fn write( sock: & TcpSocket , raw_write_data: ~[ u8] )
265
265
-> result:: Result <( ) , TcpErrData > unsafe {
266
266
let socket_data_ptr = ptr:: addr_of ( * ( sock. socket_data ) ) ;
267
267
write_common_impl ( socket_data_ptr, raw_write_data)
@@ -298,7 +298,7 @@ fn write(sock: TcpSocket, raw_write_data: ~[u8])
298
298
* `result` object with a `nil` value as the `ok` variant, or a `tcp_err_data`
299
299
* value as the `err` variant
300
300
*/
301
- fn write_future( sock: TcpSocket , raw_write_data: ~[ u8] )
301
+ fn write_future( sock: & TcpSocket , raw_write_data: ~[ u8] )
302
302
-> future:: Future <result:: Result <( ) , TcpErrData >> unsafe {
303
303
let socket_data_ptr = ptr:: addr_of ( * ( sock. socket_data ) ) ;
304
304
do future_spawn {
@@ -322,7 +322,7 @@ fn write_future(sock: TcpSocket, raw_write_data: ~[u8])
322
322
* optionally, loop on) from until `read_stop` is called, or a
323
323
* `tcp_err_data` record
324
324
*/
325
- fn read_start ( sock : TcpSocket )
325
+ fn read_start ( sock : & TcpSocket )
326
326
-> result:: Result < comm:: Port <
327
327
result:: Result < ~[ u8 ] , TcpErrData > > , TcpErrData > unsafe {
328
328
let socket_data = ptr:: addr_of ( * ( sock. socket_data ) ) ;
@@ -336,8 +336,8 @@ fn read_start(sock: TcpSocket)
336
336
*
337
337
* * `sock` - a `net::tcp::tcp_socket` that you wish to stop reading on
338
338
*/
339
- fn read_stop ( sock : TcpSocket ,
340
- - read_port : comm:: Port < result:: Result < ~[ u8 ] , TcpErrData > > ) ->
339
+ fn read_stop ( sock : & TcpSocket ,
340
+ + read_port : comm:: Port < result:: Result < ~[ u8 ] , TcpErrData > > ) ->
341
341
result:: Result < ( ) , TcpErrData > unsafe {
342
342
log ( debug, fmt ! ( "taking the read_port out of commission %?" , read_port) ) ;
343
343
let socket_data = ptr:: addr_of ( * sock. socket_data ) ;
@@ -359,7 +359,7 @@ fn read_stop(sock: TcpSocket,
359
359
* * `timeout_msecs` - a `uint` value, in msecs, to wait before dropping the
360
360
* read attempt. Pass `0u` to wait indefinitely
361
361
*/
362
- fn read ( sock : TcpSocket , timeout_msecs : uint )
362
+ fn read ( sock : & TcpSocket , timeout_msecs : uint )
363
363
-> result:: Result < ~[ u8 ] , TcpErrData > {
364
364
let socket_data = ptr:: addr_of ( * ( sock. socket_data ) ) ;
365
365
read_common_impl ( socket_data, timeout_msecs)
@@ -394,7 +394,7 @@ fn read(sock: TcpSocket, timeout_msecs: uint)
394
394
* * `timeout_msecs` - a `uint` value, in msecs, to wait before dropping the
395
395
* read attempt. Pass `0u` to wait indefinitely
396
396
*/
397
- fn read_future ( sock : TcpSocket , timeout_msecs : uint )
397
+ fn read_future ( sock : & TcpSocket , timeout_msecs : uint )
398
398
-> future:: Future < result:: Result < ~[ u8 ] , TcpErrData > > {
399
399
let socket_data = ptr:: addr_of ( * ( sock. socket_data ) ) ;
400
400
do future_spawn {
@@ -569,9 +569,9 @@ fn accept(new_conn: TcpNewConnection)
569
569
* successful/normal shutdown, and a `tcp_listen_err_data` enum in the event
570
570
* of listen exiting because of an error
571
571
*/
572
- fn listen ( - host_ip : ip:: IpAddr , port : uint , backlog : uint ,
572
+ fn listen ( + host_ip : ip:: IpAddr , port : uint , backlog : uint ,
573
573
iotask : IoTask ,
574
- on_establish_cb : fn ~( comm:: Chan < Option < TcpErrData > > ) ,
574
+ + on_establish_cb : fn ~( comm:: Chan < Option < TcpErrData > > ) ,
575
575
+new_connect_cb : fn ~( TcpNewConnection ,
576
576
comm:: Chan < Option < TcpErrData > > ) )
577
577
-> result:: Result < ( ) , TcpListenErrData > unsafe {
@@ -586,10 +586,10 @@ fn listen(-host_ip: ip::IpAddr, port: uint, backlog: uint,
586
586
}
587
587
}
588
588
589
- fn listen_common ( - host_ip : ip:: IpAddr , port : uint , backlog : uint ,
589
+ fn listen_common ( + host_ip : ip:: IpAddr , port : uint , backlog : uint ,
590
590
iotask : IoTask ,
591
- on_establish_cb : fn ~( comm:: Chan < Option < TcpErrData > > ) ,
592
- - on_connect_cb : fn ~( * uv:: ll:: uv_tcp_t ) )
591
+ + on_establish_cb : fn ~( comm:: Chan < Option < TcpErrData > > ) ,
592
+ + on_connect_cb : fn ~( * uv:: ll:: uv_tcp_t ) )
593
593
-> result:: Result < ( ) , TcpListenErrData > unsafe {
594
594
let stream_closed_po = core:: comm:: Port :: < ( ) > ( ) ;
595
595
let kill_po = core:: comm:: Port :: < Option < TcpErrData > > ( ) ;
@@ -726,36 +726,36 @@ fn listen_common(-host_ip: ip::IpAddr, port: uint, backlog: uint,
726
726
*
727
727
* A buffered wrapper that you can cast as an `io::reader` or `io::writer`
728
728
*/
729
- fn socket_buf ( - sock : TcpSocket ) -> TcpSocketBuf {
729
+ fn socket_buf ( + sock : TcpSocket ) -> TcpSocketBuf {
730
730
TcpSocketBuf ( @{ sock: move sock, mut buf: ~[ ] } )
731
731
}
732
732
733
733
/// Convenience methods extending `net::tcp::tcp_socket`
734
734
impl TcpSocket {
735
735
fn read_start ( ) -> result:: Result < comm:: Port <
736
736
result:: Result < ~[ u8 ] , TcpErrData > > , TcpErrData > {
737
- read_start ( self )
737
+ read_start ( & self )
738
738
}
739
739
fn read_stop ( -read_port :
740
740
comm:: Port < result:: Result < ~[ u8 ] , TcpErrData > > ) ->
741
741
result:: Result < ( ) , TcpErrData > {
742
- read_stop ( self , move read_port)
742
+ read_stop ( & self , move read_port)
743
743
}
744
744
fn read ( timeout_msecs : uint ) ->
745
745
result:: Result < ~[ u8 ] , TcpErrData > {
746
- read ( self , timeout_msecs)
746
+ read ( & self , timeout_msecs)
747
747
}
748
748
fn read_future ( timeout_msecs : uint ) ->
749
749
future:: Future < result:: Result < ~[ u8 ] , TcpErrData > > {
750
- read_future ( self , timeout_msecs)
750
+ read_future ( & self , timeout_msecs)
751
751
}
752
752
fn write ( raw_write_data : ~[ u8 ] )
753
753
-> result:: Result < ( ) , TcpErrData > {
754
- write ( self , raw_write_data)
754
+ write ( & self , raw_write_data)
755
755
}
756
756
fn write_future ( raw_write_data : ~[ u8 ] )
757
757
-> future:: Future < result:: Result < ( ) , TcpErrData > > {
758
- write_future ( self , raw_write_data)
758
+ write_future ( & self , raw_write_data)
759
759
}
760
760
}
761
761
@@ -764,7 +764,7 @@ impl TcpSocketBuf: io::Reader {
764
764
fn read ( buf : & [ mut u8] , len : uint ) -> uint {
765
765
// Loop until our buffer has enough data in it for us to read from.
766
766
while self . data . buf . len ( ) < len {
767
- let read_result = read ( self . data . sock , 0 u) ;
767
+ let read_result = read ( & self . data . sock , 0 u) ;
768
768
if read_result. is_err ( ) {
769
769
let err_data = read_result. get_err ( ) ;
770
770
@@ -1112,7 +1112,7 @@ extern fn on_tcp_read_cb(stream: *uv::ll::uv_stream_t,
1112
1112
}
1113
1113
1114
1114
extern fn on_alloc_cb ( handle : * libc:: c_void ,
1115
- ++ suggested_size : size_t )
1115
+ suggested_size : size_t )
1116
1116
-> uv:: ll:: uv_buf_t unsafe {
1117
1117
log ( debug, ~"tcp read on_alloc_cb!");
1118
1118
let char_ptr = uv::ll::malloc_buf_base_of(suggested_size);
@@ -1470,7 +1470,7 @@ mod test {
1470
1470
*/
1471
1471
}
1472
1472
1473
- fn buf_write < W : io:: Writer > ( +w : & W , val : ~ str ) {
1473
+ fn buf_write < W : io:: Writer > ( +w : & W , val : & str ) {
1474
1474
log ( debug, fmt ! ( "BUF_WRITE: val len %?" , str :: len( val) ) ) ;
1475
1475
do str:: byte_slice ( val) |b_slice| {
1476
1476
log ( debug, fmt ! ( "BUF_WRITE: b_slice len %?" ,
@@ -1486,7 +1486,7 @@ mod test {
1486
1486
str:: from_bytes ( new_bytes)
1487
1487
}
1488
1488
1489
- fn run_tcp_test_server ( server_ip : ~ str , server_port : uint , resp : ~str ,
1489
+ fn run_tcp_test_server ( server_ip : & str , server_port : uint , + resp : ~str ,
1490
1490
server_ch : comm:: Chan < ~str > ,
1491
1491
cont_ch : comm:: Chan < ( ) > ,
1492
1492
iotask : IoTask ) -> ~str {
@@ -1524,7 +1524,7 @@ mod test {
1524
1524
let sock = result:: unwrap ( move accept_result) ;
1525
1525
log ( debug, ~"SERVER : successfully accepted"+
1526
1526
~"connection!");
1527
- let received_req_bytes = read(sock, 0u);
1527
+ let received_req_bytes = read(& sock, 0u);
1528
1528
match received_req_bytes {
1529
1529
result::Ok(data) => {
1530
1530
log(debug, ~" SERVER : got REQ str:: from_bytes..");
@@ -1533,7 +1533,7 @@ mod test {
1533
1533
server_ch. send (
1534
1534
str:: from_bytes ( data) ) ;
1535
1535
log ( debug, ~"SERVER : before write") ;
1536
- tcp_write_single ( sock, str:: to_bytes ( resp) ) ;
1536
+ tcp_write_single ( & sock, str:: to_bytes ( resp) ) ;
1537
1537
log ( debug, ~"SERVER : after write.. die") ;
1538
1538
core:: comm:: send ( kill_ch, None ) ;
1539
1539
}
@@ -1572,7 +1572,7 @@ mod test {
1572
1572
ret_val
1573
1573
}
1574
1574
1575
- fn run_tcp_test_server_fail( server_ip: ~ str , server_port: uint,
1575
+ fn run_tcp_test_server_fail( server_ip: & str, server_port: uint,
1576
1576
iotask: IoTask ) -> TcpListenErrData {
1577
1577
let server_ip_addr = ip:: v4:: parse_addr ( server_ip) ;
1578
1578
let listen_result = listen ( move server_ip_addr, server_port, 128 ,
@@ -1595,7 +1595,7 @@ mod test {
1595
1595
}
1596
1596
}
1597
1597
1598
- fn run_tcp_test_client ( server_ip : ~ str , server_port : uint , resp : ~ str ,
1598
+ fn run_tcp_test_client ( server_ip : & str , server_port : uint , resp : & str ,
1599
1599
client_ch : comm:: Chan < ~str > ,
1600
1600
iotask : IoTask ) -> result:: Result < ~str ,
1601
1601
TcpConnectErrData > {
@@ -1612,7 +1612,7 @@ mod test {
1612
1612
else {
1613
1613
let sock = result:: unwrap ( move connect_result) ;
1614
1614
let resp_bytes = str:: to_bytes ( resp) ;
1615
- tcp_write_single( sock, resp_bytes) ;
1615
+ tcp_write_single( & sock, resp_bytes) ;
1616
1616
let read_result = sock. read ( 0 u) ;
1617
1617
if read_result. is_err( ) {
1618
1618
log( debug, ~"CLIENT : failure to read");
@@ -1628,7 +1628,7 @@ mod test {
1628
1628
}
1629
1629
}
1630
1630
1631
- fn tcp_write_single ( sock : TcpSocket , val : ~[ u8 ] ) {
1631
+ fn tcp_write_single ( sock : & TcpSocket , val : ~[ u8 ] ) {
1632
1632
let write_result_future = sock. write_future ( val) ;
1633
1633
let write_result = write_result_future. get ( ) ;
1634
1634
if result:: is_err ( write_result) {
0 commit comments