File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -286,11 +286,8 @@ class RawChannel : public Nan::ObjectWrap
286286
287287 CHECK_CONDITION (hw->m_Thread , " Channel not started" );
288288
289- hw->stopThread ();
289+ hw->async_channel_stopped ();
290290
291- uv_close ((uv_handle_t *)&hw->m_AsyncReceiverReady , NULL );
292- uv_close ((uv_handle_t *)&hw->m_AsyncChannelStopped , NULL );
293- hw->Unref ();
294291 info.GetReturnValue ().Set (info.This ());
295292 }
296293
Original file line number Diff line number Diff line change @@ -34,6 +34,24 @@ exports['channel_error'] = function(test) {
3434 channel . start ( ) ;
3535}
3636
37+ exports [ 'channel_stopped' ] = function ( test ) {
38+ var channel = can . createRawChannel ( "vcan0" ) ;
39+ var stop_called = false ;
40+
41+ channel . addListener ( "onStopped" , function ( ) {
42+ stop_called = true
43+ } ) ;
44+
45+ channel . start ( ) ;
46+
47+ setTimeout ( function ( ) { channel . stop ( ) ; } , 100 ) ;
48+
49+ setTimeout ( function ( ) {
50+ test . ok ( stop_called )
51+ test . done ( )
52+ } , 100 ) ;
53+ }
54+
3755// Send 100 messages from c2 to c1
3856exports [ 'rxtx_test' ] = function ( test ) {
3957 var c1 = can . createRawChannelWithOptions ( "vcan0" , { timestamps : true } ) ;
You can’t perform that action at this time.
0 commit comments