File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -40,11 +40,38 @@ impl Close for TcpStream {
40
40
pub struct TcpListener ;
41
41
42
42
impl TcpListener {
43
- pub fn new ( _addr : IpAddr ) -> TcpListener {
43
+ pub fn bind ( _addr : IpAddr ) -> Result < TcpListener , IoError > {
44
44
fail ! ( )
45
45
}
46
46
}
47
47
48
48
impl Listener < TcpStream > for TcpListener {
49
49
fn accept ( & mut self ) -> Option < TcpStream > { fail ! ( ) }
50
50
}
51
+
52
+ #[ cfg( test) ]
53
+ mod test {
54
+ use super :: * ;
55
+ use rt:: test:: * ;
56
+
57
+ #[ test] #[ ignore]
58
+ fn smoke_test ( ) {
59
+ /*do run_in_newsched_task {
60
+ let addr = next_test_ip4();
61
+
62
+ do spawn_immediately {
63
+ let listener = TcpListener::bind(addr);
64
+ do listener.accept() {
65
+ let mut buf = [0];
66
+ listener.read(buf);
67
+ assert!(buf[0] == 99);
68
+ }
69
+ }
70
+
71
+ do spawn_immediately {
72
+ let stream = TcpStream::connect(addr);
73
+ stream.write([99]);
74
+ }
75
+ }*/
76
+ }
77
+ }
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ impl Close for UdpStream {
40
40
pub struct UdpListener ;
41
41
42
42
impl UdpListener {
43
- pub fn new ( _addr : IpAddr ) -> UdpListener {
43
+ pub fn bind ( _addr : IpAddr ) -> Result < UdpListener , IoError > {
44
44
fail ! ( )
45
45
}
46
46
}
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ impl Close for UnixStream {
40
40
pub struct UnixListener ;
41
41
42
42
impl UnixListener {
43
- pub fn new < P : PathLike > ( _path : & P ) -> UnixListener {
43
+ pub fn bind < P : PathLike > ( _path : & P ) -> Result < UnixListener , IoError > {
44
44
fail ! ( )
45
45
}
46
46
}
You can’t perform that action at this time.
0 commit comments