@ -105,7 +105,7 @@ static struct ETCP_CONN* first_conn(struct UTUN_INSTANCE* inst) {
static void srv_handler ( struct ETCP_CONN * conn , struct ll_entry * entry ) {
( void ) conn ;
if ( ! entry | | ! entry - > dgram | | entry - > len < 10 ) { // svc_id(1) + subcmd(1) + seq(4) + data_len(4)
if ( entry ) { queue_entry _free ( entry ) ; queue_dgram _free ( entry ) ; }
if ( entry ) { queue_dgram _free ( entry ) ; queue_entry _free ( entry ) ; }
return ;
}
uint8_t subcmd = entry - > dgram [ 1 ] ;
@ -123,7 +123,7 @@ static void srv_handler(struct ETCP_CONN* conn, struct ll_entry* entry) {
} else {
fwd_rcvd + + ;
}
queue_entry _free ( entry ) ; queue_dgram _free ( entry ) ;
queue_dgram _free ( entry ) ; queue_entry _free ( entry ) ;
// Send reply back
if ( ! g_test_done & & reply_sent < TOTAL_PACKETS ) {
@ -139,7 +139,7 @@ static void srv_handler(struct ETCP_CONN* conn, struct ll_entry* entry) {
etcp_route_send ( srv , client_node_id , re , 0 ) ; reply_sent + + ; }
}
} else {
queue_entry _free ( entry ) ; queue_dgram _free ( entry ) ;
queue_dgram _free ( entry ) ; queue_entry _free ( entry ) ;
}
}
@ -147,7 +147,7 @@ static void srv_handler(struct ETCP_CONN* conn, struct ll_entry* entry) {
static void cli_handler ( struct ETCP_CONN * conn , struct ll_entry * entry ) {
( void ) conn ;
if ( ! entry | | ! entry - > dgram | | entry - > len < 10 ) {
if ( entry ) { queue_entry _free ( entry ) ; queue_dgram _free ( entry ) ; }
if ( entry ) { queue_dgram _free ( entry ) ; queue_entry _free ( entry ) ; }
return ;
}
uint8_t subcmd = entry - > dgram [ 1 ] ;
@ -166,7 +166,7 @@ static void cli_handler(struct ETCP_CONN* conn, struct ll_entry* entry) {
reply_rcvd + + ;
}
}
queue_entry _free ( entry ) ; queue_dgram _free ( entry ) ;
queue_dgram _free ( entry ) ; queue_entry _free ( entry ) ;
}
// ======================== Loopback test (no ETCP) ========================
@ -178,7 +178,7 @@ static void loop_handler(struct ETCP_CONN* conn, struct ll_entry* entry) {
loop_rcvd + + ;
if ( entry - > dgram [ 1 ] = = 0xAA & & entry - > dgram [ 2 ] = = 0xBB & & entry - > dgram [ 3 ] = = 0xCC ) loop_ok = 1 ;
}
if ( entry ) { queue_entry _free ( entry ) ; queue_dgram _free ( entry ) ; }
if ( entry ) { queue_dgram _free ( entry ) ; queue_entry _free ( entry ) ; }
}
static int test_loopback ( void ) {
@ -250,7 +250,7 @@ static void monitor(void* arg) {
struct ll_entry * e = queue_entry_new ( 0 ) ;
if ( e ) { e - > dgram = u_malloc ( 10 + data_len ) ; memcpy ( e - > dgram , buf , 10 + data_len ) ; e - > len = 10 + data_len ;
if ( etcp_route_send ( cli , server_node_id , e , 0 ) = = 0 ) fwd_sent + + ;
else { queue_entry _free ( e ) ; queue_dgram _free ( e ) ; }
else { queue_dgram _free ( e ) ; queue_entry _free ( e ) ; }
}
}