@ -39,7 +39,7 @@
static struct UTUN_INSTANCE * g_a = NULL , * g_b = NULL ;
static struct UASYNC * ua = NULL ;
static int result = 0 ;
static volatile int result = 0 ;
static void * ttimer = NULL ;
static char tdir [ ] = " /tmp/utun_cm_XXXXXX " ;
static char ca [ 256 ] , cb [ 256 ] ;
@ -73,14 +73,14 @@ static void ccb(int r, uint64_t id, void* arg) {
static void test1 ( void * arg ) {
( void ) arg ; if ( result ) return ;
if ( lks ( g_a ) < 1 | | lks ( g_b ) < 1 ) { uasync_set_timeout ( ua , 50 , NULL , ( timeout_callback_t ) test1 , " t1 " ) ; return ; }
if ( ! nodeinfo_find_by_id ( g_a - > bgp , NID_B ) ) { uasync_set_timeout ( ua , 50 , NULL , ( timeout_callback_t ) test1 , " t1 " ) ; return ; }
fprintf ( stderr , " Test 1: direct — conn_mgr_connect_node(B) \n " ) ; fflush ( stderr ) ;
conn_mgr_connect_node ( g_a - > conn_mgr , NID_B , 0 , ccb , NULL ) ;
uasync_set_timeout ( ua , 10 0, NULL , ( timeout_callback_t ) test2 , " t2a " ) ;
uasync_set_timeout ( ua , 5 0, NULL , ( timeout_callback_t ) test2 , " t2a " ) ;
}
static void test2 ( void * arg ) {
( void ) arg ; if ( result ) return ;
if ( ! cdone ) { uasync_set_timeout ( ua , 10 0, NULL , ( timeout_callback_t ) test2 , " t2b " ) ; return ; }
if ( ! cdone ) { uasync_set_timeout ( ua , 5 0, NULL , ( timeout_callback_t ) test2 , " t2b " ) ; return ; }
if ( cresult ! = CONN_MGR_OK ) { fail ( " connect failed " ) ; return ; }
uint8_t st , ty ; conn_mgr_get_status ( g_a - > conn_mgr , NID_B , & st , & ty ) ;
fprintf ( stderr , " Test 2: status state=%d type=%d \n " , st , ty ) ; fflush ( stderr ) ;