diff --git a/dap-sdk/core/include/dap_common.h b/dap-sdk/core/include/dap_common.h index 2d1f1dce2e41db9610efee106b3f670b065c57e8..fdbbfc47941324f7791e12e08ef0a1aa74b97c70 100755 --- a/dap-sdk/core/include/dap_common.h +++ b/dap-sdk/core/include/dap_common.h @@ -51,7 +51,7 @@ #define pipe(pfds) _pipe(pfds, 4096, _O_BINARY) #define strerror_r(arg1, arg2, arg3) strerror_s(arg2, arg3, arg1) #define ctime_r(arg1, arg2) ctime_s(arg2, sizeof(arg2), arg1) -#define asctime_r(arg1, arg2) asctime_s(arg2, sizeof(arg2), arg1) +//#define asctime_r(arg1, arg2) asctime_s(arg2, sizeof(arg2), arg1) #endif #ifdef __MACH__ #include <dispatch/dispatch.h> diff --git a/dap-sdk/net/core/dap_worker.c b/dap-sdk/net/core/dap_worker.c index f33dd00378d3ea78699216cf8d7c098869a2018e..a39a54d1c342a918e58d01ef26db7b41a55739fd 100644 --- a/dap-sdk/net/core/dap_worker.c +++ b/dap-sdk/net/core/dap_worker.c @@ -216,7 +216,7 @@ void *dap_worker_thread(void *arg) if (l_sock_err) { log_it(L_DEBUG, "Socket %d error %d", l_cur->socket, l_sock_err); #else - if (l_err == SOCKET_ERROR) { + //if (l_err == SOCKET_ERROR) { log_it(L_DEBUG, "Socket %d will be shutdown (EPOLLHUP), error %d", l_cur->socket, WSAGetLastError()); #endif dap_events_socket_set_readable_unsafe(l_cur, false); @@ -227,8 +227,9 @@ void *dap_worker_thread(void *arg) l_cur->callbacks.error_callback(l_cur, l_sock_err); // Call callback to process error event #ifndef DAP_OS_WINDOWS log_it(L_INFO, "Socket shutdown (EPOLLHUP): %s", strerror(l_sock_err)); -#endif } +#endif + //} break; } default: @@ -244,8 +245,13 @@ void *dap_worker_thread(void *arg) l_cur->flags |= DAP_SOCK_SIGNAL_CLOSE; if (l_cur->callbacks.error_callback) l_cur->callbacks.error_callback(l_cur, l_sock_err); // Call callback to process error event - if (l_cur->fd == 0 || l_cur->fd == -1) + if (l_cur->fd == 0 || l_cur->fd == -1) { +#ifdef DAP_OS_WINDOWS + log_it(L_ERROR, "Wrong fd: %d", l_cur->fd); +#else assert_perror(errno); +#endif + } // If its not null or -1 we should try first to remove it from poll. Assert only if it doesn't help } @@ -821,7 +827,7 @@ static bool s_socket_all_check_activity( void * a_arg) dap_events_socket_t *l_es, *tmp; char l_curtimebuf[64]; time_t l_curtime= time(NULL); - ctime_r(&l_curtime, l_curtimebuf); + dap_ctime_r(&l_curtime, l_curtimebuf); //log_it(L_DEBUG,"Check sockets activity on worker #%u at %s", l_worker->id, l_curtimebuf); pthread_rwlock_rdlock(&l_worker->esocket_rwlock); HASH_ITER(hh_worker, l_worker->esockets, l_es, tmp ) { diff --git a/modules/net/dap_chain_net.c b/modules/net/dap_chain_net.c index 089f36a8952d9950c9a79e44b137a60818fa0e35..936a36ad3c92cfd12aa660d89c84825907e8152d 100644 --- a/modules/net/dap_chain_net.c +++ b/modules/net/dap_chain_net.c @@ -2150,7 +2150,7 @@ void dap_chain_net_proc_mempool (dap_chain_net_t * a_net) time_t l_ts_create = (time_t) l_datum->header.ts_create; log_it(L_INFO, "\t\t0x%s: type_id=%s ts_create=%s data_size=%u", l_objs[i].key, c_datum_type_str[l_datum->header.type_id], - ctime_r(&l_ts_create, buf), l_datum->header.data_size); + dap_ctime_r(&l_ts_create, buf), l_datum->header.data_size); } } } @@ -2476,7 +2476,7 @@ void dap_chain_net_dump_datum(dap_string_t * a_str_out, dap_chain_datum_t * a_da char buf[50]; time_t l_ts_created = l_tx->header.ts_created; dap_string_append_printf(a_str_out,"type: TX\n"); - dap_string_append_printf(a_str_out,"type: ts_created: %s \n",ctime_r(&l_ts_created, buf)); + dap_string_append_printf(a_str_out,"type: ts_created: %s \n", dap_ctime_r(&l_ts_created, buf)); int l_items_count = -1; dap_list_t * l_items = dap_chain_datum_tx_items_get(l_tx,TX_ITEM_TYPE_ANY,&l_items_count); dap_string_append_printf(a_str_out,"type: items_count: %d \n", l_items_count ); diff --git a/modules/net/dap_chain_node_cli.c b/modules/net/dap_chain_node_cli.c index 1b9cf76462401668d5f1ed15fc07a31f8dda61de..1f6c92177a9161a51f237ebe6088ccc11cdce232 100644 --- a/modules/net/dap_chain_node_cli.c +++ b/modules/net/dap_chain_node_cli.c @@ -249,7 +249,7 @@ char* s_get_next_str( SOCKET nSocket, int *dwLen, const char *stop_str, bool del static void* thread_one_client_func(void *args) { SOCKET newsockfd = (SOCKET) (intptr_t) args; - log_it(L_INFO, "new connection sockfd=%d", newsockfd); + log_it(L_DEBUG, "new connection sockfd=%d", newsockfd); int str_len, marker = 0; int timeout = 5000; // 5 sec @@ -313,7 +313,7 @@ static void* thread_one_client_func(void *args) if(l_cmd->overrides.log_cmd_call) l_cmd->overrides.log_cmd_call(str_cmd); else - log_it(L_INFO, "execute command=%s", str_cmd); + log_it(L_DEBUG, "execute command=%s", str_cmd); // exec command char **l_argv = dap_strsplit(str_cmd, ";", -1); @@ -364,7 +364,7 @@ static void* thread_one_client_func(void *args) } // close connection int cs = closesocket(newsockfd); - log_it(L_INFO, "close connection=%d sockfd=%d", cs, newsockfd); + log_it(L_DEBUG, "close connection=%d sockfd=%d", cs, newsockfd); return NULL; } diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c index 8ccc33ae6f14e1794f9f018cca75223379b6c02b..76e3b8361f2e6d53996826fabd55ff9e99921647 100644 --- a/modules/net/dap_chain_node_cli_cmd.c +++ b/modules/net/dap_chain_node_cli_cmd.c @@ -2063,7 +2063,7 @@ void s_com_mempool_list_print_for_chain(dap_chain_net_t * a_net, dap_chain_t * a dap_string_append_printf(a_str_tmp, "hash %s: type_id=%s data_size=%u data_hash=%s ts_create=%s", // \n included in timestamp l_key, c_datum_type_str[l_datum->header.type_id], - l_datum->header.data_size, l_data_hash_str, ctime_r(&l_ts_create, buf)); + l_datum->header.data_size, l_data_hash_str, dap_ctime_r(&l_ts_create, buf)); DAP_DELETE(l_key); dap_chain_net_dump_datum(a_str_tmp, l_datum, a_hash_out_type); } @@ -2278,7 +2278,7 @@ int com_mempool_proc(int argc, char ** argv, void *arg_func, char ** a_str_reply time_t l_ts_create = (time_t) l_datum->header.ts_create; dap_string_append_printf(l_str_tmp, "hash %s: type_id=%s ts_create=%s data_size=%u\n", l_datum_hash_out_str, c_datum_type_str[l_datum->header.type_id], - ctime_r(&l_ts_create, buf), l_datum->header.data_size); + dap_ctime_r(&l_ts_create, buf), l_datum->header.data_size); int l_verify_datum= dap_chain_net_verify_datum_for_add( l_net, l_datum) ; if (l_verify_datum != 0){ dap_string_append_printf(l_str_tmp, "Error! Datum doesn't pass verifications (code %d) examine node log files", diff --git a/modules/type/dag/dap_chain_cs_dag.c b/modules/type/dag/dap_chain_cs_dag.c index 7dc373d9e38d78a806ecbc647df1f96d61c52e63..85540d1906fdab0e1804211eb0e7614040a5818d 100644 --- a/modules/type/dag/dap_chain_cs_dag.c +++ b/modules/type/dag/dap_chain_cs_dag.c @@ -1493,7 +1493,7 @@ static int s_cli_dag(int argc, char ** argv, void *arg_func, char **a_str_reply) dap_string_append_printf(l_str_tmp,"\t\t\t\tversion: 0x%02X\n",l_event->header.version); dap_string_append_printf(l_str_tmp,"\t\t\t\tcell_id: 0x%016llX\n",l_event->header.cell_id.uint64); dap_string_append_printf(l_str_tmp,"\t\t\t\tchain_id: 0x%016llX\n",l_event->header.chain_id.uint64); - dap_string_append_printf(l_str_tmp,"\t\t\t\tts_created: %s\n",ctime_r(&l_ts_reated, buf) ); + dap_string_append_printf(l_str_tmp,"\t\t\t\tts_created: %s\n", dap_ctime_r(&l_ts_reated, buf) ); // Hash links dap_string_append_printf(l_str_tmp,"\t\t\t\thashes:\tcount: %u\n",l_event->header.hash_count); @@ -1513,7 +1513,7 @@ static int s_cli_dag(int argc, char ** argv, void *arg_func, char **a_str_reply) dap_string_append_printf(l_str_tmp,"\t\t\t\tdatum:\tdatum_size: %u\n",l_datum_size); dap_string_append_printf(l_str_tmp,"\t\t\t\t\t\tversion:=0x%02X\n", l_datum->header.version_id); dap_string_append_printf(l_str_tmp,"\t\t\t\t\t\ttype_id:=%s\n", c_datum_type_str[l_datum->header.type_id]); - dap_string_append_printf(l_str_tmp,"\t\t\t\t\t\tts_create=%s\n",ctime_r( &l_datum_ts_create,buf )); + dap_string_append_printf(l_str_tmp,"\t\t\t\t\t\tts_create=%s\n", dap_ctime_r( &l_datum_ts_create,buf )); dap_string_append_printf(l_str_tmp,"\t\t\t\t\t\tdata_size=%u\n", l_datum->header.data_size); // Signatures @@ -1565,7 +1565,7 @@ static int s_cli_dag(int argc, char ** argv, void *arg_func, char **a_str_reply) char buf[50]; time_t l_ts_create = (time_t) l_event->header.ts_created; dap_string_append_printf(l_str_tmp,"\t%s: ts_create=%s", - l_objs[i].key, ctime_r( &l_ts_create,buf ) ); + l_objs[i].key, dap_ctime_r( &l_ts_create,buf ) ); } // bugs-3932 @@ -1593,7 +1593,7 @@ static int s_cli_dag(int argc, char ** argv, void *arg_func, char **a_str_reply) char * l_event_item_hash_str = dap_chain_hash_fast_to_str_new( &l_event_item->hash); time_t l_ts_create = (time_t) l_event_item->event->header.ts_created; dap_string_append_printf(l_str_tmp,"\t%s: ts_create=%s", - l_event_item_hash_str, ctime_r( &l_ts_create,buf ) ); + l_event_item_hash_str, dap_ctime_r( &l_ts_create,buf ) ); DAP_DELETE(l_event_item_hash_str); } pthread_rwlock_unlock(&PVT(l_dag)->events_rwlock);