@ -107,7 +107,7 @@ static int db_exec(const char* sql) {
char * err = NULL ;
char * err = NULL ;
int rc = sqlite3_exec ( g_cc . db , sql , NULL , NULL , & err ) ;
int rc = sqlite3_exec ( g_cc . db , sql , NULL , NULL , & err ) ;
if ( rc ! = SQLITE_OK ) {
if ( rc ! = SQLITE_OK ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: sql error: %s " , CC_ID , err ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: sql error: %s " , CC_ID , err ) ;
sqlite3_free ( err ) ;
sqlite3_free ( err ) ;
}
}
return rc ;
return rc ;
@ -121,7 +121,7 @@ int chat_core_init(struct UTUN_INSTANCE* inst, const char* db_path) {
int rc = sqlite3_open ( db_path , & g_cc . db ) ;
int rc = sqlite3_open ( db_path , & g_cc . db ) ;
if ( rc ! = SQLITE_OK ) {
if ( rc ! = SQLITE_OK ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: cannot open DB %s: %s " ,
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: cannot open DB %s: %s " ,
CC_ID , db_path , sqlite3_errmsg ( g_cc . db ) ) ;
CC_ID , db_path , sqlite3_errmsg ( g_cc . db ) ) ;
sqlite3_close ( g_cc . db ) ; g_cc . db = NULL ; return - 1 ;
sqlite3_close ( g_cc . db ) ; g_cc . db = NULL ; return - 1 ;
}
}
@ -162,7 +162,7 @@ int chat_core_init(struct UTUN_INSTANCE* inst, const char* db_path) {
) ;
) ;
g_cc . initialized = 1 ;
g_cc . initialized = 1 ;
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: initialized, db=%s node_id=0x%016llx " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: initialized, db=%s node_id=0x%016llx " ,
CC_ID , db_path , ( unsigned long long ) g_cc . my_node_id ) ;
CC_ID , db_path , ( unsigned long long ) g_cc . my_node_id ) ;
return 0 ;
return 0 ;
}
}
@ -177,7 +177,7 @@ void chat_core_destroy(struct UTUN_INSTANCE* inst) {
if ( g_cc . db ) { sqlite3_close ( g_cc . db ) ; g_cc . db = NULL ; }
if ( g_cc . db ) { sqlite3_close ( g_cc . db ) ; g_cc . db = NULL ; }
g_cc . inst = NULL ;
g_cc . inst = NULL ;
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: destroyed " , CC_ID ) ;
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: destroyed " , CC_ID ) ;
}
}
void chat_core_set_my_node_id ( uint64_t node_id ) {
void chat_core_set_my_node_id ( uint64_t node_id ) {
@ -188,7 +188,7 @@ void chat_core_set_my_node_id(uint64_t node_id) {
void chat_core_submit_message ( struct chat_msg_submit * req ) {
void chat_core_submit_message ( struct chat_msg_submit * req ) {
if ( ! g_cc . initialized ) {
if ( ! g_cc . initialized ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: submit_message called before init " , CC_ID ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: submit_message called before init " , CC_ID ) ;
return ;
return ;
}
}
if ( ! req ) return ;
if ( ! req ) return ;
@ -213,7 +213,7 @@ void chat_core_submit_message(struct chat_msg_submit* req) {
sqlite3_stmt * stmt = NULL ;
sqlite3_stmt * stmt = NULL ;
if ( sqlite3_prepare_v2 ( g_cc . db , sql , - 1 , & stmt , NULL ) ! = SQLITE_OK ) {
if ( sqlite3_prepare_v2 ( g_cc . db , sql , - 1 , & stmt , NULL ) ! = SQLITE_OK ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: prepare insert failed: %s " ,
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: prepare insert failed: %s " ,
CC_ID , sqlite3_errmsg ( g_cc . db ) ) ;
CC_ID , sqlite3_errmsg ( g_cc . db ) ) ;
return ;
return ;
}
}
@ -231,17 +231,17 @@ void chat_core_submit_message(struct chat_msg_submit* req) {
sqlite3_finalize ( stmt ) ;
sqlite3_finalize ( stmt ) ;
if ( rc = = SQLITE_DONE ) {
if ( rc = = SQLITE_DONE ) {
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: msg inserted ch=%s ts=%llu dh=0x%016llx " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: msg inserted ch=%s ts=%llu dh=0x%016llx " ,
CC_ID , ch_id , ( unsigned long long ) ts , ( unsigned long long ) dh ) ;
CC_ID , ch_id , ( unsigned long long ) ts , ( unsigned long long ) dh ) ;
/* push пирам */
/* push пирам */
chat_sync_push ( g_cc . inst , ch_id , g_cc . my_node_id ,
chat_sync_push ( g_cc . inst , ch_id , g_cc . my_node_id ,
req - > content_type , data , data_len , ts , dh ) ;
req - > content_type , data , data_len , ts , dh ) ;
} else if ( rc = = SQLITE_CONSTRAINT ) {
} else if ( rc = = SQLITE_CONSTRAINT ) {
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: msg duplicate ch=%s ts=%llu " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: msg duplicate ch=%s ts=%llu " ,
CC_ID , ch_id , ( unsigned long long ) ts ) ;
CC_ID , ch_id , ( unsigned long long ) ts ) ;
} else {
} else {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: insert msg failed: %s " ,
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: insert msg failed: %s " ,
CC_ID , sqlite3_errmsg ( g_cc . db ) ) ;
CC_ID , sqlite3_errmsg ( g_cc . db ) ) ;
}
}
}
}
@ -253,7 +253,7 @@ void chat_core_submit_trampoline(void* arg) {
void chat_core_push_message ( struct chat_msg_submit * req ) {
void chat_core_push_message ( struct chat_msg_submit * req ) {
if ( ! g_cc . initialized ) {
if ( ! g_cc . initialized ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: push_message called before init " , CC_ID ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: push_message called before init " , CC_ID ) ;
return ;
return ;
}
}
if ( ! req ) return ;
if ( ! req ) return ;
@ -261,7 +261,7 @@ void chat_core_push_message(struct chat_msg_submit* req) {
uint64_t dh ;
uint64_t dh ;
compute_datahash ( req - > data , req - > data_len , & dh ) ;
compute_datahash ( req - > data , req - > data_len , & dh ) ;
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: pushing msg ch=%s ts=%llu dh=0x%016llx " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: pushing msg ch=%s ts=%llu dh=0x%016llx " ,
CC_ID , req - > channel_id , ( unsigned long long ) req - > timestamp , ( unsigned long long ) dh ) ;
CC_ID , req - > channel_id , ( unsigned long long ) req - > timestamp , ( unsigned long long ) dh ) ;
chat_sync_push ( g_cc . inst , req - > channel_id , g_cc . my_node_id ,
chat_sync_push ( g_cc . inst , req - > channel_id , g_cc . my_node_id ,
@ -340,7 +340,7 @@ int chat_core_insert_record(const char* ch_id, const uint8_t* rec, size_t len) {
uint8_t expected [ 32 ] ;
uint8_t expected [ 32 ] ;
compute_chain_hash ( prev , ts , dh , expected ) ;
compute_chain_hash ( prev , ts , dh , expected ) ;
if ( memcmp ( expected , peer_ch , 32 ) ! = 0 ) {
if ( memcmp ( expected , peer_ch , 32 ) ! = 0 ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: chain_hash mismatch ch=%s ts=%lld dh=0x%016llx " ,
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: chain_hash mismatch ch=%s ts=%lld dh=0x%016llx " ,
CC_ID , ch_id , ( long long ) ts , ( unsigned long long ) dh ) ;
CC_ID , ch_id , ( long long ) ts , ( unsigned long long ) dh ) ;
return - 1 ;
return - 1 ;
}
}
@ -623,7 +623,7 @@ static void cc_parallel_ready_cb(struct ETCP_CONN* conn, void* arg) {
memcpy ( data + 12 , & st - > channel_id , 8 ) ;
memcpy ( data + 12 , & st - > channel_id , 8 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , data , 20 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , data , 20 ) ;
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: parallel connect SUCCESS idx=%d peer=0x%016llx " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: parallel connect SUCCESS idx=%d peer=0x%016llx " ,
CC_ID , pctx - > addr_index , ( unsigned long long ) st - > node_id ) ;
CC_ID , pctx - > addr_index , ( unsigned long long ) st - > node_id ) ;
for ( int i = 0 ; i < st - > addr_count ; i + + ) {
for ( int i = 0 ; i < st - > addr_count ; i + + ) {
@ -643,7 +643,7 @@ static void cc_parallel_timeout_cb(void* arg) {
st - > timers [ pctx - > addr_index ] = NULL ;
st - > timers [ pctx - > addr_index ] = NULL ;
st - > pending_count - - ;
st - > pending_count - - ;
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: parallel connect TIMEOUT idx=%d pending=%d/%d peer=0x%016llx " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: parallel connect TIMEOUT idx=%d pending=%d/%d peer=0x%016llx " ,
CC_ID , pctx - > addr_index , st - > pending_count , st - > addr_count , ( unsigned long long ) st - > node_id ) ;
CC_ID , pctx - > addr_index , st - > pending_count , st - > addr_count , ( unsigned long long ) st - > node_id ) ;
if ( st - > pending_count < = 0 & & ! st - > completed ) {
if ( st - > pending_count < = 0 & & ! st - > completed ) {
@ -663,7 +663,7 @@ void chat_core_connect_from_invite(struct chat_invite* inv) {
if ( ! g_cc . initialized | | ! g_cc . inst | | ! inv ) return ;
if ( ! g_cc . initialized | | ! g_cc . inst | | ! inv ) return ;
struct TOPO_GROUP * group = topo_groups_get_default ( g_cc . inst - > topo_groups ) ;
struct TOPO_GROUP * group = topo_groups_get_default ( g_cc . inst - > topo_groups ) ;
if ( ! group | | ! g_cc . inst - > conn_mgr ) {
if ( ! group | | ! g_cc . inst - > conn_mgr ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: bgp/conn_mgr not available " , CC_ID ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: bgp/conn_mgr not available " , CC_ID ) ;
uint8_t err [ 12 ] ; int r = - 7 ;
uint8_t err [ 12 ] ; int r = - 7 ;
memcpy ( err , & inv - > node_id , 8 ) ; memcpy ( err + 8 , & r , 4 ) ;
memcpy ( err , & inv - > node_id , 8 ) ; memcpy ( err + 8 , & r , 4 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , err , 12 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , err , 12 ) ;
@ -673,7 +673,7 @@ void chat_core_connect_from_invite(struct chat_invite* inv) {
uint64_t node_id = inv - > node_id ;
uint64_t node_id = inv - > node_id ;
if ( topo_node_find_by_id ( group , node_id ) ) {
if ( topo_node_find_by_id ( group , node_id ) ) {
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: node 0x%016llx already in BGP, connecting " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: node 0x%016llx already in BGP, connecting " ,
CC_ID , ( unsigned long long ) node_id ) ;
CC_ID , ( unsigned long long ) node_id ) ;
conn_mgr_connect_node ( g_cc . inst - > conn_mgr , node_id , 30000 ,
conn_mgr_connect_node ( g_cc . inst - > conn_mgr , node_id , 30000 ,
connect_result_cb , & inv - > channel_id ) ;
connect_result_cb , & inv - > channel_id ) ;
@ -682,7 +682,7 @@ void chat_core_connect_from_invite(struct chat_invite* inv) {
struct ll_entry * qe = queue_entry_new ( sizeof ( struct TOPO_NODEQ ) ) ;
struct ll_entry * qe = queue_entry_new ( sizeof ( struct TOPO_NODEQ ) ) ;
if ( ! qe ) {
if ( ! qe ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: failed to alloc TOPO_NODEQ " , CC_ID ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: failed to alloc TOPO_NODEQ " , CC_ID ) ;
uint8_t err [ 12 ] ; int r = - 7 ;
uint8_t err [ 12 ] ; int r = - 7 ;
memcpy ( err , & node_id , 8 ) ; memcpy ( err + 8 , & r , 4 ) ;
memcpy ( err , & node_id , 8 ) ; memcpy ( err + 8 , & r , 4 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , err , 12 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , err , 12 ) ;
@ -730,14 +730,14 @@ void chat_core_connect_from_invite(struct chat_invite* inv) {
queue_data_put_with_index ( group - > nodes , & nq - > ll ) ;
queue_data_put_with_index ( group - > nodes , & nq - > ll ) ;
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: created NODEINFO for 0x%016llx, %d addrs, parallel connect " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: created NODEINFO for 0x%016llx, %d addrs, parallel connect " ,
CC_ID , ( unsigned long long ) node_id , inv - > addr_count ) ;
CC_ID , ( unsigned long long ) node_id , inv - > addr_count ) ;
/* count IPv4 addresses and collect them for parallel connect */
/* count IPv4 addresses and collect them for parallel connect */
int v4_count = 0 ;
int v4_count = 0 ;
for ( struct TOPO_ADDR4 * a = addrs_head ; a ; a = a - > next ) v4_count + + ;
for ( struct TOPO_ADDR4 * a = addrs_head ; a ; a = a - > next ) v4_count + + ;
if ( v4_count = = 0 ) {
if ( v4_count = = 0 ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: no IPv4 addresses in invite " , CC_ID ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: no IPv4 addresses in invite " , CC_ID ) ;
uint8_t err [ 20 ] ; memcpy ( err , & node_id , 8 ) ; int r = CONN_MGR_ERR_NO_ADDRESSES ;
uint8_t err [ 20 ] ; memcpy ( err , & node_id , 8 ) ; int r = CONN_MGR_ERR_NO_ADDRESSES ;
memcpy ( err + 8 , & r , 4 ) ; memset ( err + 12 , 0 , 8 ) ;
memcpy ( err + 8 , & r , 4 ) ; memset ( err + 12 , 0 , 8 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , err , 20 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , err , 20 ) ;
@ -747,7 +747,7 @@ void chat_core_connect_from_invite(struct chat_invite* inv) {
struct ETCP_SOCKET * best_socket = g_cc . inst - > etcp_sockets ;
struct ETCP_SOCKET * best_socket = g_cc . inst - > etcp_sockets ;
while ( best_socket & & best_socket - > local_addr . ss_family ! = AF_INET ) best_socket = best_socket - > next ;
while ( best_socket & & best_socket - > local_addr . ss_family ! = AF_INET ) best_socket = best_socket - > next ;
if ( ! best_socket ) {
if ( ! best_socket ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: no AF_INET socket " , CC_ID ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: no AF_INET socket " , CC_ID ) ;
uint8_t err [ 20 ] ; memcpy ( err , & node_id , 8 ) ; int r = CONN_MGR_ERR_INTERNAL ;
uint8_t err [ 20 ] ; memcpy ( err , & node_id , 8 ) ; int r = CONN_MGR_ERR_INTERNAL ;
memcpy ( err + 8 , & r , 4 ) ; memset ( err + 12 , 0 , 8 ) ;
memcpy ( err + 8 , & r , 4 ) ; memset ( err + 12 , 0 , 8 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , err , 20 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , err , 20 ) ;
@ -781,7 +781,7 @@ void chat_core_connect_from_invite(struct chat_invite* inv) {
struct ETCP_CONN * conn = etcp_connection_create ( g_cc . inst , NULL ) ;
struct ETCP_CONN * conn = etcp_connection_create ( g_cc . inst , NULL ) ;
if ( ! conn ) {
if ( ! conn ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: etcp_connection_create failed idx=%d " , CC_ID , idx ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: etcp_connection_create failed idx=%d " , CC_ID , idx ) ;
pst - > conns [ idx ] = NULL ; pst - > timers [ idx ] = NULL ; pst - > pending_count - - ; continue ;
pst - > conns [ idx ] = NULL ; pst - > timers [ idx ] = NULL ; pst - > pending_count - - ; continue ;
}
}
sc_init_ctx ( & conn - > crypto_ctx , & g_cc . inst - > my_keys ) ;
sc_init_ctx ( & conn - > crypto_ctx , & g_cc . inst - > my_keys ) ;
@ -794,20 +794,20 @@ void chat_core_connect_from_invite(struct chat_invite* inv) {
etcp_conn_set_ready_cbk ( conn , cc_parallel_ready_cb , pctx ) ;
etcp_conn_set_ready_cbk ( conn , cc_parallel_ready_cb , pctx ) ;
if ( ! etcp_link_new ( conn , best_socket , & sa , 0 ) ) {
if ( ! etcp_link_new ( conn , best_socket , & sa , 0 ) ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: etcp_link_new failed idx=%d " , CC_ID , idx ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: etcp_link_new failed idx=%d " , CC_ID , idx ) ;
u_free ( pctx ) ; etcp_connection_close ( conn ) ;
u_free ( pctx ) ; etcp_connection_close ( conn ) ;
pst - > conns [ idx ] = NULL ; pst - > timers [ idx ] = NULL ; pst - > pending_count - - ; continue ;
pst - > conns [ idx ] = NULL ; pst - > timers [ idx ] = NULL ; pst - > pending_count - - ; continue ;
}
}
pst - > conns [ idx ] = conn ;
pst - > conns [ idx ] = conn ;
pst - > timers [ idx ] = uasync_set_timeout ( g_cc . inst - > ua , CC_PARALLEL_CONNECT_TIMEOUT_MS * 10 ,
pst - > timers [ idx ] = uasync_set_timeout ( g_cc . inst - > ua , CC_PARALLEL_CONNECT_TIMEOUT_MS * 10 ,
pctx , cc_parallel_timeout_cb , " cc_parallel " ) ;
pctx , cc_parallel_timeout_cb , " cc_parallel " ) ;
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: parallel connect attempt %d/%d to %d.%d.%d.%d:%d " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: parallel connect attempt %d/%d to %d.%d.%d.%d:%d " ,
CC_ID , idx + 1 , v4_count , sin . sin_addr . s_addr & 0xFF , ( sin . sin_addr . s_addr > > 8 ) & 0xFF ,
CC_ID , idx + 1 , v4_count , sin . sin_addr . s_addr & 0xFF , ( sin . sin_addr . s_addr > > 8 ) & 0xFF ,
( sin . sin_addr . s_addr > > 16 ) & 0xFF , ( sin . sin_addr . s_addr > > 24 ) & 0xFF , a - > port ) ;
( sin . sin_addr . s_addr > > 16 ) & 0xFF , ( sin . sin_addr . s_addr > > 24 ) & 0xFF , a - > port ) ;
}
}
if ( pst - > pending_count < = 0 & & ! pst - > completed ) {
if ( pst - > pending_count < = 0 & & ! pst - > completed ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: all %d parallel connects failed to start " , CC_ID , v4_count ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: all %d parallel connects failed to start " , CC_ID , v4_count ) ;
uint8_t err [ 20 ] ; memcpy ( err , & node_id , 8 ) ; int r = CONN_MGR_ERR_UNREACHABLE ;
uint8_t err [ 20 ] ; memcpy ( err , & node_id , 8 ) ; int r = CONN_MGR_ERR_UNREACHABLE ;
memcpy ( err + 8 , & r , 4 ) ; memcpy ( err + 12 , & inv - > channel_id , 8 ) ;
memcpy ( err + 8 , & r , 4 ) ; memcpy ( err + 12 , & inv - > channel_id , 8 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , err , 20 ) ;
gui_bridge_post ( GUI_EVT_CONNECT_RESULT , err , 20 ) ;
@ -819,13 +819,13 @@ void chat_core_connect_from_invite(struct chat_invite* inv) {
void chat_core_create_channel ( struct chat_channel_create * req ) {
void chat_core_create_channel ( struct chat_channel_create * req ) {
if ( ! g_cc . initialized ) {
if ( ! g_cc . initialized ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: create_channel NOT INITIALIZED ch=%s " ,
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: create_channel NOT INITIALIZED ch=%s " ,
CC_ID , req ? req - > channel_id : " (null) " ) ;
CC_ID , req ? req - > channel_id : " (null) " ) ;
return ;
return ;
}
}
if ( ! req ) { DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: create_channel req=NULL " , CC_ID ) ; return ; }
if ( ! req ) { DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: create_channel req=NULL " , CC_ID ) ; return ; }
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: create_channel BEGIN ch=%s name=%s " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: create_channel BEGIN ch=%s name=%s " ,
CC_ID , req - > channel_id , req - > name ) ;
CC_ID , req - > channel_id , req - > name ) ;
char tbl_msg [ 80 ] ; msg_table_name ( req - > channel_id , tbl_msg , sizeof ( tbl_msg ) ) ;
char tbl_msg [ 80 ] ; msg_table_name ( req - > channel_id , tbl_msg , sizeof ( tbl_msg ) ) ;
@ -860,10 +860,10 @@ void chat_core_create_channel(struct chat_channel_create* req) {
req - > signature ) ;
req - > signature ) ;
if ( rc ! = 0 ) {
if ( rc ! = 0 ) {
DEBUG_ERROR ( DEBUG_CATEGORY_DEBUG , " %s: channel_put FAILED ch=%s rc=%d " ,
DEBUG_ERROR ( DEBUG_CATEGORY_CONNECTIVITY , " %s: channel_put FAILED ch=%s rc=%d " ,
CC_ID , req - > channel_id , rc ) ;
CC_ID , req - > channel_id , rc ) ;
} else {
} else {
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: channel_put OK ch=%s name=%s owner=0x%016llx " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: channel_put OK ch=%s name=%s owner=0x%016llx " ,
CC_ID , req - > channel_id , req - > name , ( unsigned long long ) req - > owner_node_id ) ;
CC_ID , req - > channel_id , req - > name , ( unsigned long long ) req - > owner_node_id ) ;
/* уведомляем GUI */
/* уведомляем GUI */
@ -872,13 +872,13 @@ void chat_core_create_channel(struct chat_channel_create* req) {
data [ 0 ] = ch_id_len ;
data [ 0 ] = ch_id_len ;
memcpy ( data + 1 , req - > channel_id , ch_id_len ) ;
memcpy ( data + 1 , req - > channel_id , ch_id_len ) ;
gui_bridge_post ( GUI_EVT_CHANNEL_UPDATED , data , 1 + ch_id_len ) ;
gui_bridge_post ( GUI_EVT_CHANNEL_UPDATED , data , 1 + ch_id_len ) ;
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " %s: gui_bridge_post sent GUI_EVT_CHANNEL_UPDATED ch=%s " ,
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " %s: gui_bridge_post sent GUI_EVT_CHANNEL_UPDATED ch=%s " ,
CC_ID , req - > channel_id ) ;
CC_ID , req - > channel_id ) ;
}
}
}
}
void chat_core_create_channel_trampoline ( void * arg ) {
void chat_core_create_channel_trampoline ( void * arg ) {
DEBUG_INFO ( DEBUG_CATEGORY_DEBUG , " chat_core: TRAMPOLINE invoked arg=%p " , arg ) ;
DEBUG_INFO ( DEBUG_CATEGORY_CONNECTIVITY , " chat_core: TRAMPOLINE invoked arg=%p " , arg ) ;
struct chat_channel_create * req = ( struct chat_channel_create * ) arg ;
struct chat_channel_create * req = ( struct chat_channel_create * ) arg ;
chat_core_create_channel ( req ) ;
chat_core_create_channel ( req ) ;
u_free ( req ) ;
u_free ( req ) ;