@@ -317,7 +317,7 @@ impl Drop for UvTcpListener {
317
317
318
318
impl RtioSocket for UvTcpListener {
319
319
// XXX implement
320
- fn socket_name ( & self ) -> IpAddr { fail ! ( ) ; }
320
+ fn socket_name ( & mut self ) -> IpAddr { fail ! ( ) ; }
321
321
}
322
322
323
323
impl RtioTcpListener for UvTcpListener {
@@ -357,8 +357,8 @@ impl RtioTcpListener for UvTcpListener {
357
357
}
358
358
359
359
// XXX implement
360
- fn accept_simultaneously ( & self ) { fail ! ( ) ; }
361
- fn dont_accept_simultaneously ( & self ) { fail ! ( ) ; }
360
+ fn accept_simultaneously ( & mut self ) { fail ! ( ) ; }
361
+ fn dont_accept_simultaneously ( & mut self ) { fail ! ( ) ; }
362
362
}
363
363
364
364
// FIXME #6090: Prefer newtype structs but Drop doesn't work
@@ -380,11 +380,11 @@ impl Drop for UvTcpStream {
380
380
381
381
impl RtioSocket for UvTcpStream {
382
382
// XXX implement
383
- fn socket_name ( & self ) -> IpAddr { fail ! ( ) ; }
383
+ fn socket_name ( & mut self ) -> IpAddr { fail ! ( ) ; }
384
384
}
385
385
386
386
impl RtioTcpStream for UvTcpStream {
387
- fn read ( & self , buf : & mut [ u8 ] ) -> Result < uint , IoError > {
387
+ fn read ( & mut self , buf : & mut [ u8 ] ) -> Result < uint , IoError > {
388
388
let result_cell = Cell :: new_empty ( ) ;
389
389
let result_cell_ptr: * Cell < Result < uint , IoError > > = & result_cell;
390
390
@@ -427,7 +427,7 @@ impl RtioTcpStream for UvTcpStream {
427
427
return result_cell. take ( ) ;
428
428
}
429
429
430
- fn write ( & self , buf : & [ u8 ] ) -> Result < ( ) , IoError > {
430
+ fn write ( & mut self , buf : & [ u8 ] ) -> Result < ( ) , IoError > {
431
431
let result_cell = Cell :: new_empty ( ) ;
432
432
let result_cell_ptr: * Cell < Result < ( ) , IoError > > = & result_cell;
433
433
let scheduler = Local :: take :: < Scheduler > ( ) ;
@@ -456,11 +456,11 @@ impl RtioTcpStream for UvTcpStream {
456
456
}
457
457
458
458
// XXX implement
459
- fn peer_name ( & self ) -> IpAddr { fail ! ( ) ; }
460
- fn control_congestion ( & self ) { fail ! ( ) ; }
461
- fn nodelay ( & self ) { fail ! ( ) ; }
462
- fn keepalive ( & self , _delay_in_seconds : uint ) { fail ! ( ) ; }
463
- fn letdie ( & self ) { fail ! ( ) ; }
459
+ fn peer_name ( & mut self ) -> IpAddr { fail ! ( ) ; }
460
+ fn control_congestion ( & mut self ) { fail ! ( ) ; }
461
+ fn nodelay ( & mut self ) { fail ! ( ) ; }
462
+ fn keepalive ( & mut self , _delay_in_seconds : uint ) { fail ! ( ) ; }
463
+ fn letdie ( & mut self ) { fail ! ( ) ; }
464
464
}
465
465
466
466
pub struct UvUdpSocket ( UdpWatcher ) ;
@@ -481,11 +481,11 @@ impl Drop for UvUdpSocket {
481
481
482
482
impl RtioSocket for UvUdpSocket {
483
483
// XXX implement
484
- fn socket_name ( & self ) -> IpAddr { fail ! ( ) ; }
484
+ fn socket_name ( & mut self ) -> IpAddr { fail ! ( ) ; }
485
485
}
486
486
487
487
impl RtioUdpSocket for UvUdpSocket {
488
- fn recvfrom ( & self , buf : & mut [ u8 ] ) -> Result < ( uint , IpAddr ) , IoError > {
488
+ fn recvfrom ( & mut self , buf : & mut [ u8 ] ) -> Result < ( uint , IpAddr ) , IoError > {
489
489
let result_cell = Cell :: new_empty ( ) ;
490
490
let result_cell_ptr: * Cell < Result < ( uint , IpAddr ) , IoError > > = & result_cell;
491
491
@@ -521,7 +521,7 @@ impl RtioUdpSocket for UvUdpSocket {
521
521
return result_cell. take ( ) ;
522
522
}
523
523
524
- fn sendto ( & self , buf : & [ u8 ] , dst : IpAddr ) -> Result < ( ) , IoError > {
524
+ fn sendto ( & mut self , buf : & [ u8 ] , dst : IpAddr ) -> Result < ( ) , IoError > {
525
525
let result_cell = Cell :: new_empty ( ) ;
526
526
let result_cell_ptr: * Cell < Result < ( ) , IoError > > = & result_cell;
527
527
let scheduler = Local :: take :: < Scheduler > ( ) ;
@@ -549,17 +549,17 @@ impl RtioUdpSocket for UvUdpSocket {
549
549
}
550
550
551
551
// XXX implement
552
- fn join_multicast ( & self , _multi : IpAddr ) { fail ! ( ) ; }
553
- fn leave_multicast ( & self , _multi : IpAddr ) { fail ! ( ) ; }
552
+ fn join_multicast ( & mut self , _multi : IpAddr ) { fail ! ( ) ; }
553
+ fn leave_multicast ( & mut self , _multi : IpAddr ) { fail ! ( ) ; }
554
554
555
- fn loop_multicast_locally ( & self ) { fail ! ( ) ; }
556
- fn dont_loop_multicast_locally ( & self ) { fail ! ( ) ; }
555
+ fn loop_multicast_locally ( & mut self ) { fail ! ( ) ; }
556
+ fn dont_loop_multicast_locally ( & mut self ) { fail ! ( ) ; }
557
557
558
- fn multicast_time_to_live ( & self , _ttl : int ) { fail ! ( ) ; }
559
- fn time_to_live ( & self , _ttl : int ) { fail ! ( ) ; }
558
+ fn multicast_time_to_live ( & mut self , _ttl : int ) { fail ! ( ) ; }
559
+ fn time_to_live ( & mut self , _ttl : int ) { fail ! ( ) ; }
560
560
561
- fn hear_broadcasts ( & self ) { fail ! ( ) ; }
562
- fn ignore_broadcasts ( & self ) { fail ! ( ) ; }
561
+ fn hear_broadcasts ( & mut self ) { fail ! ( ) ; }
562
+ fn ignore_broadcasts ( & mut self ) { fail ! ( ) ; }
563
563
}
564
564
565
565
#[ test]
@@ -596,7 +596,7 @@ fn test_simple_tcp_server_and_client() {
596
596
unsafe {
597
597
let io = Local :: unsafe_borrow :: < IoFactoryObject > ( ) ;
598
598
let mut listener = ( * io) . tcp_bind ( addr) . unwrap ( ) ;
599
- let stream = listener. accept ( ) . unwrap ( ) ;
599
+ let mut stream = listener. accept ( ) . unwrap ( ) ;
600
600
let mut buf = [ 0 , .. 2048 ] ;
601
601
let nread = stream. read ( buf) . unwrap ( ) ;
602
602
assert_eq ! ( nread, 8 ) ;
@@ -610,7 +610,7 @@ fn test_simple_tcp_server_and_client() {
610
610
do spawntask_immediately {
611
611
unsafe {
612
612
let io = Local :: unsafe_borrow :: < IoFactoryObject > ( ) ;
613
- let stream = ( * io) . tcp_connect ( addr) . unwrap ( ) ;
613
+ let mut stream = ( * io) . tcp_connect ( addr) . unwrap ( ) ;
614
614
stream. write ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ) ;
615
615
}
616
616
}
@@ -626,7 +626,7 @@ fn test_simple_udp_server_and_client() {
626
626
do spawntask_immediately {
627
627
unsafe {
628
628
let io = Local :: unsafe_borrow :: < IoFactoryObject > ( ) ;
629
- let server_socket = ( * io) . udp_bind ( server_addr) . unwrap ( ) ;
629
+ let mut server_socket = ( * io) . udp_bind ( server_addr) . unwrap ( ) ;
630
630
let mut buf = [ 0 , .. 2048 ] ;
631
631
let ( nread, src) = server_socket. recvfrom ( buf) . unwrap ( ) ;
632
632
assert_eq ! ( nread, 8 ) ;
@@ -641,7 +641,7 @@ fn test_simple_udp_server_and_client() {
641
641
do spawntask_immediately {
642
642
unsafe {
643
643
let io = Local :: unsafe_borrow :: < IoFactoryObject > ( ) ;
644
- let client_socket = ( * io) . udp_bind ( client_addr) . unwrap ( ) ;
644
+ let mut client_socket = ( * io) . udp_bind ( client_addr) . unwrap ( ) ;
645
645
client_socket. sendto ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ] , server_addr) ;
646
646
}
647
647
}
@@ -656,7 +656,7 @@ fn test_read_and_block() {
656
656
do spawntask_immediately {
657
657
let io = unsafe { Local :: unsafe_borrow :: < IoFactoryObject > ( ) } ;
658
658
let mut listener = unsafe { ( * io) . tcp_bind ( addr) . unwrap ( ) } ;
659
- let stream = listener. accept ( ) . unwrap ( ) ;
659
+ let mut stream = listener. accept ( ) . unwrap ( ) ;
660
660
let mut buf = [ 0 , .. 2048 ] ;
661
661
662
662
let expected = 32 ;
@@ -689,7 +689,7 @@ fn test_read_and_block() {
689
689
do spawntask_immediately {
690
690
unsafe {
691
691
let io = Local :: unsafe_borrow :: < IoFactoryObject > ( ) ;
692
- let stream = ( * io) . tcp_connect ( addr) . unwrap ( ) ;
692
+ let mut stream = ( * io) . tcp_connect ( addr) . unwrap ( ) ;
693
693
stream. write ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ) ;
694
694
stream. write ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ) ;
695
695
stream. write ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ) ;
@@ -710,7 +710,7 @@ fn test_read_read_read() {
710
710
unsafe {
711
711
let io = Local :: unsafe_borrow :: < IoFactoryObject > ( ) ;
712
712
let mut listener = ( * io) . tcp_bind ( addr) . unwrap ( ) ;
713
- let stream = listener. accept ( ) . unwrap ( ) ;
713
+ let mut stream = listener. accept ( ) . unwrap ( ) ;
714
714
let buf = [ 1 , .. 2048 ] ;
715
715
let mut total_bytes_written = 0 ;
716
716
while total_bytes_written < MAX {
@@ -723,7 +723,7 @@ fn test_read_read_read() {
723
723
do spawntask_immediately {
724
724
unsafe {
725
725
let io = Local :: unsafe_borrow :: < IoFactoryObject > ( ) ;
726
- let stream = ( * io) . tcp_connect ( addr) . unwrap ( ) ;
726
+ let mut stream = ( * io) . tcp_connect ( addr) . unwrap ( ) ;
727
727
let mut buf = [ 0 , .. 2048 ] ;
728
728
let mut total_bytes_read = 0 ;
729
729
while total_bytes_read < MAX {
@@ -749,7 +749,7 @@ fn test_udp_twice() {
749
749
do spawntask_immediately {
750
750
unsafe {
751
751
let io = Local :: unsafe_borrow :: < IoFactoryObject > ( ) ;
752
- let client = ( * io) . udp_bind ( client_addr) . unwrap ( ) ;
752
+ let mut client = ( * io) . udp_bind ( client_addr) . unwrap ( ) ;
753
753
assert ! ( client. sendto( [ 1 ] , server_addr) . is_ok( ) ) ;
754
754
assert ! ( client. sendto( [ 2 ] , server_addr) . is_ok( ) ) ;
755
755
}
@@ -758,7 +758,7 @@ fn test_udp_twice() {
758
758
do spawntask_immediately {
759
759
unsafe {
760
760
let io = Local :: unsafe_borrow :: < IoFactoryObject > ( ) ;
761
- let server = ( * io) . udp_bind ( server_addr) . unwrap ( ) ;
761
+ let mut server = ( * io) . udp_bind ( server_addr) . unwrap ( ) ;
762
762
let mut buf1 = [ 0 ] ;
763
763
let mut buf2 = [ 0 ] ;
764
764
let ( nread1, src1) = server. recvfrom ( buf1) . unwrap ( ) ;
@@ -786,8 +786,8 @@ fn test_udp_many_read() {
786
786
do spawntask_immediately {
787
787
unsafe {
788
788
let io = Local :: unsafe_borrow :: < IoFactoryObject > ( ) ;
789
- let server_out = ( * io) . udp_bind ( server_out_addr) . unwrap ( ) ;
790
- let server_in = ( * io) . udp_bind ( server_in_addr) . unwrap ( ) ;
789
+ let mut server_out = ( * io) . udp_bind ( server_out_addr) . unwrap ( ) ;
790
+ let mut server_in = ( * io) . udp_bind ( server_in_addr) . unwrap ( ) ;
791
791
let msg = [ 1 , .. 2048 ] ;
792
792
let mut total_bytes_sent = 0 ;
793
793
let mut buf = [ 1 ] ;
@@ -809,8 +809,8 @@ fn test_udp_many_read() {
809
809
do spawntask_immediately {
810
810
unsafe {
811
811
let io = Local :: unsafe_borrow :: < IoFactoryObject > ( ) ;
812
- let client_out = ( * io) . udp_bind ( client_out_addr) . unwrap ( ) ;
813
- let client_in = ( * io) . udp_bind ( client_in_addr) . unwrap ( ) ;
812
+ let mut client_out = ( * io) . udp_bind ( client_out_addr) . unwrap ( ) ;
813
+ let mut client_in = ( * io) . udp_bind ( client_in_addr) . unwrap ( ) ;
814
814
let mut total_bytes_recv = 0 ;
815
815
let mut buf = [ 0 , .. 2048 ] ;
816
816
while total_bytes_recv < MAX {
0 commit comments