diff --git a/dap-sdk/net/client/dap_client_http.c b/dap-sdk/net/client/dap_client_http.c index e9dbec618e364a15545771afa808ee62e42b77d3..2371d6cd58d2faba7729b5275fed15dbb1f72a30 100644 --- a/dap-sdk/net/client/dap_client_http.c +++ b/dap-sdk/net/client/dap_client_http.c @@ -383,8 +383,8 @@ void* dap_client_http_request_custom(const char *a_uplink_addr, uint16_t a_uplin dap_events_socket_create_after(l_ev_socket); } else { - log_it(L_ERROR, "Remote address can't connected (%s:%u) with sock_id %d err=%d", a_uplink_addr, a_uplink_port, - l_socket, errno); + log_it(L_ERROR, "Remote address can't connected (%s:%u) with sock_id %d err: %s", a_uplink_addr, a_uplink_port, + l_socket, strerror(errno)); //l_ev_socket->no_close = false; dap_events_socket_kill_socket(l_ev_socket); //shutdown(l_ev_socket->socket, SHUT_RDWR); diff --git a/dap-sdk/net/core/dap_events.c b/dap-sdk/net/core/dap_events.c index 0d8e6009e7635933d49ea3d98c91982ade5d3f38..5bc14c605485a164b3a94987c1b07a4ae1e6292f 100644 --- a/dap-sdk/net/core/dap_events.c +++ b/dap-sdk/net/core/dap_events.c @@ -289,7 +289,7 @@ static void *thread_worker_function(void *arg) // memset( &events, 0, sizeof(events) ); size_t total_sent; - int bytes_sent; + int bytes_sent = 0; while(1) { diff --git a/dap-sdk/net/stream/stream/dap_stream.c b/dap-sdk/net/stream/stream/dap_stream.c index adc20540126577325035768c18a2f47330ce9269..34cc1b870fc73139417608397faa518038aafc90 100644 --- a/dap-sdk/net/stream/stream/dap_stream.c +++ b/dap-sdk/net/stream/stream/dap_stream.c @@ -476,7 +476,7 @@ void s_data_read(dap_client_remote_t* a_client, void * arg) int * ret = (int *) arg; if (s_dump_packet_headers ) { - log_it(L_DEBUG,"dap_stream_data_read: client->buf_in_size=%u" , + log_it(L_DEBUG,"dap_stream_data_read: ready_to_write=%s, client->buf_in_size=%u" , (a_client->flags & DAP_SOCK_READY_TO_WRITE)?"true":"false", a_client->buf_in_size ); } *ret = dap_stream_data_proc_read( l_stream); diff --git a/modules/chain/dap_chain_ledger.c b/modules/chain/dap_chain_ledger.c index 03ee9c0cb8d3f8bd8378b43f723c10e560705216..a484ac82a6a934365f06707fcaee4bcac0899b0e 100644 --- a/modules/chain/dap_chain_ledger.c +++ b/modules/chain/dap_chain_ledger.c @@ -912,8 +912,10 @@ int dap_chain_ledger_tx_add(dap_ledger_t *a_ledger, dap_chain_datum_tx_t *a_tx) // delete transaction from the cache list //ret = dap_chain_ledger_tx_remove(a_ledger, l_tx_hash); // there should be no duplication - log_it(L_WARNING, "Transaction (hash=0x%x) deleted from cache because there is an attempt to add it to cache", - l_tx_hash); + char * l_hash_str = dap_chain_hash_fast_to_str_new(l_tx_hash); + log_it(L_WARNING, "Transaction (hash=%s) deleted from cache because there is an attempt to add it to cache", + l_hash_str); + DAP_DELETE(l_hash_str); ret = 1; goto FIN; } diff --git a/modules/net/dap_chain_net.c b/modules/net/dap_chain_net.c index 04cbb57a92b7dd73f18fa2c9d9eb2bfee969b350..05a171839ec0eefcae8021b17ddc2493e9743801 100644 --- a/modules/net/dap_chain_net.c +++ b/modules/net/dap_chain_net.c @@ -2111,7 +2111,7 @@ dap_chain_datum_tx_t * dap_chain_net_get_tx_by_hash(dap_chain_net_t * a_net, dap dap_list_t * dap_chain_net_get_add_gdb_group(dap_chain_net_t * a_net, dap_chain_node_addr_t a_node_addr) { dap_list_t *l_list_groups = NULL; - if(!PVT(a_net)->gdb_sync_nodes_addrs || !a_net) + if(!a_net || !PVT(a_net) || !PVT(a_net)->gdb_sync_nodes_addrs) return NULL; for(uint16_t i = 0; i < PVT(a_net)->gdb_sync_nodes_addrs_count; i++) { if(a_node_addr.uint64 == PVT(a_net)->gdb_sync_nodes_addrs[i].uint64) { @@ -2161,6 +2161,11 @@ void dap_chain_net_dump_datum(dap_string_t * a_str_out, dap_chain_datum_t * a_da case DAP_CHAIN_DATUM_TOKEN_DECL:{ dap_chain_datum_token_t * l_token = (dap_chain_datum_token_t*) a_datum->data; size_t l_token_size = a_datum->header.data_size; + if(l_token_size < sizeof(dap_chain_datum_token_t)){ + dap_string_append_printf(a_str_out,"==Datum has incorrect size. Only %lu, while at least %lu is expected\n", + l_token_size, sizeof(dap_chain_datum_token_t)); + return; + } dap_string_append_printf(a_str_out,"==Datum Token Declaration\n"); dap_string_append_printf(a_str_out, "ticker: %s\n", l_token->ticker); dap_string_append_printf(a_str_out, "size: %zd\n", l_token_size); @@ -2334,7 +2339,7 @@ void dap_chain_net_dump_datum(dap_string_t * a_str_out, dap_chain_datum_t * a_da } } - int l_certs_field_size = l_token_size - sizeof(*l_token) - l_token->header_private_decl.tsd_total_size; + size_t l_certs_field_size = l_token_size - sizeof(*l_token) - l_token->header_private_decl.tsd_total_size; dap_chain_datum_token_certs_dump(a_str_out, l_token->data_n_tsd, l_certs_field_size); }break; case DAP_CHAIN_DATUM_TOKEN_TYPE_PUBLIC:{ diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c index b4272b63e2e90185c59ae6861523363424cbffe9..c6a23444b02b427c36398af89258a60977dc6f80 100644 --- a/modules/net/dap_chain_node_cli_cmd.c +++ b/modules/net/dap_chain_node_cli_cmd.c @@ -1145,11 +1145,10 @@ int com_node(int a_argc, char ** a_argv, void *arg_func, char **a_str_reply) // TODO add progress info to console res = dap_chain_node_client_wait(l_node_client, NODE_CLIENT_STATE_SYNCED, timeout_ms); if(res < 0) { + dap_chain_node_cli_set_reply_text(a_str_reply, "Error: can't sync with node "NODE_ADDR_FP_STR, + NODE_ADDR_FP_ARGS_S(l_node_client->remote_node_addr)); dap_chain_node_client_close(l_node_client); DAP_DELETE(l_remote_node_info); - dap_chain_node_cli_set_reply_text(a_str_reply, "Error: can't sync with node "NODE_ADDR_FP_STR, - NODE_ADDR_FP_ARGS_S(l_node_client->remote_node_addr)); - log_it(L_WARNING, "Gdb synced err -2"); return -2; diff --git a/modules/net/dap_chain_node_cli_cmd_tx.c b/modules/net/dap_chain_node_cli_cmd_tx.c index 32ea1ae2e53b6934179c906c5133317717deb78f..3424ca612fb9782b33cb37f6e18df8379d56fe2d 100644 --- a/modules/net/dap_chain_node_cli_cmd_tx.c +++ b/modules/net/dap_chain_node_cli_cmd_tx.c @@ -275,11 +275,11 @@ char* dap_db_history_tx(dap_chain_hash_fast_t* a_tx_hash, dap_chain_t * a_chain) dap_tx_data_t *l_iter_current, *l_item_tmp; HASH_ITER(hh, l_tx_data_hash , l_iter_current, l_item_tmp) { + HASH_DEL(l_tx_data_hash, l_iter_current); // delete datum DAP_DELETE(l_iter_current->datum); // delete struct DAP_DELETE(l_iter_current); - HASH_DEL(l_tx_data_hash, l_iter_current); } // if no history diff --git a/modules/net/dap_dns_server.c b/modules/net/dap_dns_server.c index 27ead03d2bf7f08dda8d529ce53363cfdac5876c..b781f9892fc52a2404acecc367f787bc7c24c813 100644 --- a/modules/net/dap_dns_server.c +++ b/modules/net/dap_dns_server.c @@ -314,7 +314,6 @@ void dap_dns_server_start() { return; } s_dns_server->instance->client_read_callback = dap_dns_client_read; - s_dns_server->instance->client_read_callback = *dap_dns_client_read; s_dns_server->instance->client_write_callback = NULL; s_dns_server->instance->client_new_callback = NULL; s_dns_server->instance->client_delete_callback = NULL; diff --git a/modules/type/dag/dap_chain_cs_dag.c b/modules/type/dag/dap_chain_cs_dag.c index 1e6acf8751e67bf2731d745c008da99144a21fa4..78c1198dab82402a7b7cc4551c2d0cb554baa83b 100644 --- a/modules/type/dag/dap_chain_cs_dag.c +++ b/modules/type/dag/dap_chain_cs_dag.c @@ -587,7 +587,9 @@ static int s_chain_callback_atom_verify(dap_chain_t * a_chain, dap_chain_atom_pt dap_chain_cs_dag_event_item_t * l_event_search = NULL; HASH_FIND(hh, PVT(l_dag)->events ,l_hash ,sizeof (*l_hash), l_event_search); if ( l_event_search == NULL ){ - log_it(L_DEBUG, "Hash %s wasn't in hashtable of previously parsed", l_hash); + char * l_hash_str = dap_chain_hash_fast_to_str_new(l_hash); + log_it(L_DEBUG, "Hash %s wasn't in hashtable of previously parsed", l_hash_str); + DAP_DELETE(l_hash_str); return 1; }