@@ -259,51 +259,51 @@ impl HomingIO for TcpWatcher {
259
259
260
260
impl rtio:: RtioSocket for TcpWatcher {
261
261
fn socket_name ( & mut self ) -> Result < SocketAddr , IoError > {
262
- let _m = self . fire_missiles ( ) ;
262
+ let _m = self . fire_homing_missile ( ) ;
263
263
socket_name ( Tcp , self . handle )
264
264
}
265
265
}
266
266
267
267
impl rtio:: RtioTcpStream for TcpWatcher {
268
268
fn read ( & mut self , buf : & mut [ u8 ] ) -> Result < uint , IoError > {
269
- let _m = self . fire_missiles ( ) ;
269
+ let _m = self . fire_homing_missile ( ) ;
270
270
self . stream . read ( buf) . map_err ( uv_error_to_io_error)
271
271
}
272
272
273
273
fn write ( & mut self , buf : & [ u8 ] ) -> Result < ( ) , IoError > {
274
- let _m = self . fire_missiles ( ) ;
274
+ let _m = self . fire_homing_missile ( ) ;
275
275
self . stream . write ( buf) . map_err ( uv_error_to_io_error)
276
276
}
277
277
278
278
fn peer_name ( & mut self ) -> Result < SocketAddr , IoError > {
279
- let _m = self . fire_missiles ( ) ;
279
+ let _m = self . fire_homing_missile ( ) ;
280
280
socket_name ( TcpPeer , self . handle )
281
281
}
282
282
283
283
fn control_congestion ( & mut self ) -> Result < ( ) , IoError > {
284
- let _m = self . fire_missiles ( ) ;
284
+ let _m = self . fire_homing_missile ( ) ;
285
285
status_to_io_result ( unsafe {
286
286
uvll:: uv_tcp_nodelay ( self . handle , 0 as c_int )
287
287
} )
288
288
}
289
289
290
290
fn nodelay ( & mut self ) -> Result < ( ) , IoError > {
291
- let _m = self . fire_missiles ( ) ;
291
+ let _m = self . fire_homing_missile ( ) ;
292
292
status_to_io_result ( unsafe {
293
293
uvll:: uv_tcp_nodelay ( self . handle , 1 as c_int )
294
294
} )
295
295
}
296
296
297
297
fn keepalive ( & mut self , delay_in_seconds : uint ) -> Result < ( ) , IoError > {
298
- let _m = self . fire_missiles ( ) ;
298
+ let _m = self . fire_homing_missile ( ) ;
299
299
status_to_io_result ( unsafe {
300
300
uvll:: uv_tcp_keepalive ( self . handle , 1 as c_int ,
301
301
delay_in_seconds as c_uint )
302
302
} )
303
303
}
304
304
305
305
fn letdie ( & mut self ) -> Result < ( ) , IoError > {
306
- let _m = self . fire_missiles ( ) ;
306
+ let _m = self . fire_homing_missile ( ) ;
307
307
status_to_io_result ( unsafe {
308
308
uvll:: uv_tcp_keepalive ( self . handle , 0 as c_int , 0 as c_uint )
309
309
} )
@@ -312,7 +312,7 @@ impl rtio::RtioTcpStream for TcpWatcher {
312
312
313
313
impl Drop for TcpWatcher {
314
314
fn drop ( & mut self ) {
315
- let _m = self . fire_missiles ( ) ;
315
+ let _m = self . fire_homing_missile ( ) ;
316
316
self . stream . close ( ) ;
317
317
}
318
318
}
@@ -356,7 +356,7 @@ impl UvHandle<uvll::uv_tcp_t> for TcpListener {
356
356
357
357
impl rtio:: RtioSocket for TcpListener {
358
358
fn socket_name ( & mut self ) -> Result < SocketAddr , IoError > {
359
- let _m = self . fire_missiles ( ) ;
359
+ let _m = self . fire_homing_missile ( ) ;
360
360
socket_name ( Tcp , self . handle )
361
361
}
362
362
}
@@ -370,7 +370,7 @@ impl rtio::RtioTcpListener for TcpListener {
370
370
incoming : incoming,
371
371
} ;
372
372
373
- let _m = acceptor. fire_missiles ( ) ;
373
+ let _m = acceptor. fire_homing_missile ( ) ;
374
374
// XXX: the 128 backlog should be configurable
375
375
match unsafe { uvll:: uv_listen ( acceptor. listener . handle , 128 , listen_cb) } {
376
376
0 => Ok ( acceptor as ~rtio:: RtioTcpAcceptor ) ,
@@ -399,7 +399,7 @@ extern fn listen_cb(server: *uvll::uv_stream_t, status: c_int) {
399
399
400
400
impl Drop for TcpListener {
401
401
fn drop ( & mut self ) {
402
- let ( _m, sched) = self . fire_missiles_sched ( ) ;
402
+ let ( _m, sched) = self . fire_homing_missile_sched ( ) ;
403
403
404
404
do sched. deschedule_running_task_and_then |_, task| {
405
405
self . closing_task = Some ( task) ;
@@ -424,26 +424,26 @@ impl HomingIO for TcpAcceptor {
424
424
425
425
impl rtio:: RtioSocket for TcpAcceptor {
426
426
fn socket_name ( & mut self ) -> Result < SocketAddr , IoError > {
427
- let _m = self . fire_missiles ( ) ;
427
+ let _m = self . fire_homing_missile ( ) ;
428
428
socket_name ( Tcp , self . listener . handle )
429
429
}
430
430
}
431
431
432
432
impl rtio:: RtioTcpAcceptor for TcpAcceptor {
433
433
fn accept ( & mut self ) -> Result < ~rtio:: RtioTcpStream , IoError > {
434
- let _m = self . fire_missiles ( ) ;
434
+ let _m = self . fire_homing_missile ( ) ;
435
435
self . incoming . recv ( )
436
436
}
437
437
438
438
fn accept_simultaneously ( & mut self ) -> Result < ( ) , IoError > {
439
- let _m = self . fire_missiles ( ) ;
439
+ let _m = self . fire_homing_missile ( ) ;
440
440
status_to_io_result ( unsafe {
441
441
uvll:: uv_tcp_simultaneous_accepts ( self . listener . handle , 1 )
442
442
} )
443
443
}
444
444
445
445
fn dont_accept_simultaneously ( & mut self ) -> Result < ( ) , IoError > {
446
- let _m = self . fire_missiles ( ) ;
446
+ let _m = self . fire_homing_missile ( ) ;
447
447
status_to_io_result ( unsafe {
448
448
uvll:: uv_tcp_simultaneous_accepts ( self . listener . handle , 0 )
449
449
} )
@@ -489,7 +489,7 @@ impl HomingIO for UdpWatcher {
489
489
490
490
impl rtio:: RtioSocket for UdpWatcher {
491
491
fn socket_name ( & mut self ) -> Result < SocketAddr , IoError > {
492
- let _m = self . fire_missiles ( ) ;
492
+ let _m = self . fire_homing_missile ( ) ;
493
493
socket_name ( Udp , self . handle )
494
494
}
495
495
}
@@ -503,7 +503,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
503
503
buf : Option < Buf > ,
504
504
result : Option < ( ssize_t , SocketAddr ) > ,
505
505
}
506
- let _m = self . fire_missiles ( ) ;
506
+ let _m = self . fire_homing_missile ( ) ;
507
507
508
508
return match unsafe {
509
509
uvll:: uv_udp_recv_start ( self . handle , alloc_cb, recv_cb)
@@ -564,7 +564,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
564
564
fn sendto( & mut self , buf: & [ u8] , dst: SocketAddr ) -> Result < ( ) , IoError > {
565
565
struct Ctx { task: Option < BlockedTask > , result : c_int }
566
566
567
- let _m = self . fire_missiles ( ) ;
567
+ let _m = self . fire_homing_missile ( ) ;
568
568
569
569
let req = Request :: new( uvll:: UV_UDP_SEND ) ;
570
570
let buf = slice_to_uv_buf( buf) ;
@@ -607,7 +607,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
607
607
}
608
608
609
609
fn join_multicast( & mut self , multi: IpAddr ) -> Result < ( ) , IoError > {
610
- let _m = self . fire_missiles ( ) ;
610
+ let _m = self . fire_homing_missile ( ) ;
611
611
status_to_io_result( unsafe {
612
612
do multi. to_str( ) . with_c_str |m_addr| {
613
613
uvll:: uv_udp_set_membership( self . handle,
@@ -618,7 +618,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
618
618
}
619
619
620
620
fn leave_multicast( & mut self , multi: IpAddr ) -> Result < ( ) , IoError > {
621
- let _m = self . fire_missiles ( ) ;
621
+ let _m = self . fire_homing_missile ( ) ;
622
622
status_to_io_result( unsafe {
623
623
do multi. to_str( ) . with_c_str |m_addr| {
624
624
uvll:: uv_udp_set_membership( self . handle,
@@ -629,46 +629,46 @@ impl rtio::RtioUdpSocket for UdpWatcher {
629
629
}
630
630
631
631
fn loop_multicast_locally( & mut self ) -> Result < ( ) , IoError > {
632
- let _m = self . fire_missiles ( ) ;
632
+ let _m = self . fire_homing_missile ( ) ;
633
633
status_to_io_result( unsafe {
634
634
uvll : : uv_udp_set_multicast_loop( self . handle,
635
635
1 as c_int)
636
636
} )
637
637
}
638
638
639
639
fn dont_loop_multicast_locally( & mut self ) -> Result < ( ) , IoError > {
640
- let _m = self . fire_missiles ( ) ;
640
+ let _m = self . fire_homing_missile ( ) ;
641
641
status_to_io_result( unsafe {
642
642
uvll : : uv_udp_set_multicast_loop( self . handle,
643
643
0 as c_int)
644
644
} )
645
645
}
646
646
647
647
fn multicast_time_to_live( & mut self , ttl: int) -> Result < ( ) , IoError > {
648
- let _m = self . fire_missiles ( ) ;
648
+ let _m = self . fire_homing_missile ( ) ;
649
649
status_to_io_result( unsafe {
650
650
uvll : : uv_udp_set_multicast_ttl( self . handle,
651
651
ttl as c_int)
652
652
} )
653
653
}
654
654
655
655
fn time_to_live( & mut self , ttl: int) -> Result < ( ) , IoError > {
656
- let _m = self . fire_missiles ( ) ;
656
+ let _m = self . fire_homing_missile ( ) ;
657
657
status_to_io_result( unsafe {
658
658
uvll : : uv_udp_set_ttl( self . handle, ttl as c_int)
659
659
} )
660
660
}
661
661
662
662
fn hear_broadcasts( & mut self ) -> Result < ( ) , IoError > {
663
- let _m = self . fire_missiles ( ) ;
663
+ let _m = self . fire_homing_missile ( ) ;
664
664
status_to_io_result( unsafe {
665
665
uvll : : uv_udp_set_broadcast( self . handle,
666
666
1 as c_int)
667
667
} )
668
668
}
669
669
670
670
fn ignore_broadcasts( & mut self ) -> Result < ( ) , IoError > {
671
- let _m = self . fire_missiles ( ) ;
671
+ let _m = self . fire_homing_missile ( ) ;
672
672
status_to_io_result( unsafe {
673
673
uvll : : uv_udp_set_broadcast( self . handle,
674
674
0 as c_int)
@@ -679,7 +679,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
679
679
impl Drop for UdpWatcher {
680
680
fn drop( & mut self ) {
681
681
// Send ourselves home to close this handle (blocking while doing so).
682
- let ( _m, sched) = self . fire_missiles_sched ( ) ;
682
+ let ( _m, sched) = self . fire_homing_missile_sched ( ) ;
683
683
let mut slot = None ;
684
684
unsafe {
685
685
uvll:: set_data_for_uv_handle( self . handle, & slot) ;
@@ -693,6 +693,7 @@ impl Drop for UdpWatcher {
693
693
let slot: & mut Option < BlockedTask > = unsafe {
694
694
cast:: transmute( uvll:: get_data_for_uv_handle( handle) )
695
695
} ;
696
+ unsafe { uvll:: free_handle( handle) }
696
697
let sched: ~Scheduler = Local :: take( ) ;
697
698
sched. resume_blocked_task_immediately( slot. take_unwrap( ) ) ;
698
699
}
0 commit comments