]> git.lizzy.rs Git - rust.git/blobdiff - src/librustuv/net.rs
Fix usage of libuv for windows
[rust.git] / src / librustuv / net.rs
index 10b8f50e387ce4377284971766d8bef3fbd54ea2..32c9b6c3d172999f6efffb262b81ca3624840784 100644 (file)
@@ -883,6 +883,7 @@ fn test_read_read_read() {
     }
 
     #[test]
+    #[ignore(cfg(windows))] // FIXME(#10102) server never sees second packet
     fn test_udp_twice() {
         let server_addr = next_test_ip4();
         let client_addr = next_test_ip4();
@@ -1168,6 +1169,56 @@ unsafe fn local_io() -> &'static mut IoFactory {
         }
     }
 
+    #[should_fail] #[test]
+    fn tcp_listener_fail_cleanup() {
+        let addr = next_test_ip4();
+        let w = TcpListener::bind(local_loop(), addr).unwrap();
+        let _w = w.listen().unwrap();
+        fail!();
+    }
+
+    #[should_fail] #[test]
+    fn tcp_stream_fail_cleanup() {
+        let (port, chan) = oneshot();
+        let chan = Cell::new(chan);
+        let addr = next_test_ip4();
+
+        do task::spawn_unlinked { // please no linked failure
+            let w = TcpListener::bind(local_loop(), addr).unwrap();
+            let mut w = w.listen().unwrap();
+            chan.take().send(());
+            w.accept();
+        }
+        port.recv();
+        let _w = TcpWatcher::connect(local_loop(), addr).unwrap();
+        fail!();
+    }
+
+    #[should_fail] #[test]
+    fn udp_listener_fail_cleanup() {
+        let addr = next_test_ip4();
+        let _w = UdpWatcher::bind(local_loop(), addr).unwrap();
+        fail!();
+    }
+
+    #[should_fail] #[test]
+    fn udp_fail_other_task() {
+        let addr = next_test_ip4();
+        let (port, chan) = oneshot();
+        let chan = Cell::new(chan);
+
+        // force the handle to be created on a different scheduler, failure in
+        // the original task will force a homing operation back to this
+        // scheduler.
+        do task::spawn_sched(task::SingleThreaded) {
+            let w = UdpWatcher::bind(local_loop(), addr).unwrap();
+            chan.take().send(w);
+        }
+
+        let _w = port.recv();
+        fail!();
+    }
+
     #[should_fail]
     #[test]
     #[ignore(reason = "linked failure")]