@ -472,6 +472,7 @@ static void cm_start_phase_direct(struct CONN_MGR_ENTRY* entry) {
struct ETCP_CONN * conn = etcp_connection_create ( entry - > mgr - > instance , NULL ) ;
struct ETCP_CONN * conn = etcp_connection_create ( entry - > mgr - > instance , NULL ) ;
if ( conn ) {
if ( conn ) {
etcp_conn_set_ready_cbk ( conn , cm_direct_ready_cb , entry ) ;
etcp_conn_set_ready_cbk ( conn , cm_direct_ready_cb , entry ) ;
sc_init_ctx ( & conn - > crypto_ctx , & entry - > mgr - > instance - > my_keys ) ;
sc_set_peer_public_key ( & conn - > crypto_ctx , target - > node - > public_key , 0 ) ;
sc_set_peer_public_key ( & conn - > crypto_ctx , target - > node - > public_key , 0 ) ;
if ( etcp_link_new ( conn , s , & sa , 0 ) ) {
if ( etcp_link_new ( conn , s , & sa , 0 ) ) {
entry - > main . timer = uasync_set_timeout ( entry - > mgr - > instance - > ua , CONN_MGR_CONNECT_DIRECT_TIMEOUT_MS * 10 , entry , cm_direct_timeout_cb , " conn_mgr_direct " ) ;
entry - > main . timer = uasync_set_timeout ( entry - > mgr - > instance - > ua , CONN_MGR_CONNECT_DIRECT_TIMEOUT_MS * 10 , entry , cm_direct_timeout_cb , " conn_mgr_direct " ) ;
@ -854,7 +855,8 @@ static void cm_handle_direct_req(struct ETCP_CONN* conn, const uint8_t* data, si
struct ETCP_CONN * new_conn = etcp_connection_create ( conn - > instance , NULL ) ;
struct ETCP_CONN * new_conn = etcp_connection_create ( conn - > instance , NULL ) ;
if ( new_conn ) {
if ( new_conn ) {
struct TOPO_NODEQ * nq = topo_node_find_by_id ( topo_groups_get_default ( conn - > instance - > topo_groups ) , src_node_id ) ;
struct TOPO_NODEQ * nq = topo_node_find_by_id ( topo_groups_get_default ( conn - > instance - > topo_groups ) , src_node_id ) ;
if ( nq ) sc_set_peer_public_key ( & new_conn - > crypto_ctx , nq - > node - > public_key , 0 ) ;
if ( nq ) { sc_init_ctx ( & new_conn - > crypto_ctx , & conn - > instance - > my_keys ) ;
sc_set_peer_public_key ( & new_conn - > crypto_ctx , nq - > node - > public_key , 0 ) ; }
struct cm_reverse_pending * rp = u_calloc ( 1 , sizeof ( struct cm_reverse_pending ) ) ;
struct cm_reverse_pending * rp = u_calloc ( 1 , sizeof ( struct cm_reverse_pending ) ) ;
if ( rp ) { rp - > request_id = req - > request_id ; rp - > entry = NULL ; rp - > next = mgr - > reverse_pending ;
if ( rp ) { rp - > request_id = req - > request_id ; rp - > entry = NULL ; rp - > next = mgr - > reverse_pending ;
etcp_conn_set_ready_cbk ( new_conn , cm_reverse_ready_cb , rp ) ; mgr - > reverse_pending = rp ; }
etcp_conn_set_ready_cbk ( new_conn , cm_reverse_ready_cb , rp ) ; mgr - > reverse_pending = rp ; }