@ -416,9 +416,14 @@ static void handle_connected(struct tcp_proxy* p, uint32_t stream_id, struct ll_
queue_dgram_free ( entry ) ; queue_entry_free ( entry ) ;
}
static void handle_data ( struct tcp_proxy * p , uint32_t stream_id , struct ll_entry * entry ) {
static void handle_data ( struct tcp_proxy * p , struct ETCP_CONN * conn , uint32_t stream_id , struct ll_entry * entry ) {
struct proxy_conn * pc = find_pc_by_stream ( p , stream_id ) ;
if ( ! pc ) { DEBUG_WARN ( DEBUG_CATEGORY_SOCKET , " PROXY DATA sid=%08x — no conn, drop " , stream_id ) ; queue_dgram_free ( entry ) ; queue_entry_free ( entry ) ; return ; }
if ( ! pc ) {
DEBUG_WARN ( DEBUG_CATEGORY_SOCKET , " PROXY DATA sid=%08x — нет соединения, шлём CLOSE " , stream_id ) ;
if ( conn ) proxy_send_msg ( p - > inst , conn - > peer_node_id , TCP_PROXY_SUBCMD_CLOSE , stream_id , 0 , NULL , 0 ) ;
queue_dgram_free ( entry ) ; queue_entry_free ( entry ) ; return ;
}
if ( pc - > rem_closed | | pc - > error ) { queue_dgram_free ( entry ) ; queue_entry_free ( entry ) ; return ; }
uint16_t seq ; memcpy ( & seq , entry - > dgram + 6 , 2 ) ;
if ( ! pc - > recv_init ) {
@ -487,14 +492,14 @@ void tcp_proxy_etcp_recv_cb(struct ETCP_CONN* conn, struct ll_entry* entry) {
if ( inst & & inst - > remote_proxy . enabled ) {
struct remote_proxy_conn * rc = remote_proxy_find_conn ( & inst - > remote_proxy , stream_id ) ;
if ( rc ) {
if ( subcmd = = TCP_PROXY_SUBCMD_DATA ) { remote_proxy_handle_data ( inst , entry , stream_id ) ; return ; }
if ( subcmd = = TCP_PROXY_SUBCMD_DATA ) { remote_proxy_handle_data ( inst , conn , entry , stream_id ) ; return ; }
if ( subcmd = = TCP_PROXY_SUBCMD_CLOSE ) { remote_proxy_handle_close ( inst , stream_id ) ; queue_dgram_free ( entry ) ; queue_entry_free ( entry ) ; return ; }
if ( subcmd = = TCP_PROXY_SUBCMD_ERROR ) { DEBUG_ERROR ( DEBUG_CATEGORY_SOCKET , " RP ERROR recv sid=%08x " , stream_id ) ; rc - > error = 1 ; rp_conn_free ( rc ) ; queue_dgram_free ( entry ) ; queue_entry_free ( entry ) ; return ; }
}
}
if ( proxy ) {
if ( subcmd = = TCP_PROXY_SUBCMD_CONNECTED ) { handle_connected ( proxy , stream_id , entry ) ; return ; }
if ( subcmd = = TCP_PROXY_SUBCMD_DATA ) { handle_data ( proxy , stream_id , entry ) ; return ; }
if ( subcmd = = TCP_PROXY_SUBCMD_DATA ) { handle_data ( proxy , conn , stream_id , entry ) ; return ; }
if ( subcmd = = TCP_PROXY_SUBCMD_CLOSE ) { handle_close ( proxy , stream_id ) ; queue_dgram_free ( entry ) ; queue_entry_free ( entry ) ; return ; }
if ( subcmd = = TCP_PROXY_SUBCMD_ERROR ) { handle_error ( proxy , stream_id ) ; queue_dgram_free ( entry ) ; queue_entry_free ( entry ) ; return ; }
}