From 803388d7b80c8f10fe785ac10818c95dc723345f Mon Sep 17 00:00:00 2001 From: fanasina Date: Wed, 3 Sep 2025 08:22:37 +0200 Subject: [PATCH] y_socket: change buf send file --- y_socket_t/src/y_socket_t/y_file_handler.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/y_socket_t/src/y_socket_t/y_file_handler.c b/y_socket_t/src/y_socket_t/y_file_handler.c index b18a89e..9f22e96 100644 --- a/y_socket_t/src/y_socket_t/y_file_handler.c +++ b/y_socket_t/src/y_socket_t/y_file_handler.c @@ -121,11 +121,13 @@ void* y_socket_send_file_for_all_nodes(void* arg){ return NULL; } - // y_send_post_file_to_all_nodes(arg); - for(struct list_y_NODE_T *local_list_current = nodes->begin_list; local_list_current; local_list_current=local_list_current->next ){ + int len_header = sprintf(buf_send, "post file %s :",filename); + + //y_send_post_file_to_all_nodes(arg); + //for(struct list_y_NODE_T *local_list_current = nodes->begin_list; local_list_current; local_list_current=local_list_current->next ) //memset(buf_send, 0, BUF_SIZE+1); - while((retread = read(fd_file, buf_send, BUF_SIZE) ) > 0 ){ + while((retread = read(fd_file, buf_send+len_header, BUF_SIZE-len_header) ) > 0 ){ buf_send[retread]='\0'; //memset(msgRet, 0, BUF_SIZE + NI_MAXHOST + NI_MAXSERV + 100); // sprintf(msgRet, "from %s:%s =%s",host, service, buf); @@ -134,7 +136,7 @@ void* y_socket_send_file_for_all_nodes(void* arg){ ///printf("debug: sending response %s :\n",buf_send); //FOR_LIST_FORM_BEGIN(y_NODE_T, nodes) - //for(struct list_y_NODE_T *local_list_current = nodes->begin_list; local_list_current; local_list_current=local_list_current->next ) + for(struct list_y_NODE_T *local_list_current = nodes->begin_list; local_list_current; local_list_current=local_list_current->next ){ //memset(tempAddr, 0, BUF_SIZE+1); c_af=(local_list_current->value).addr.ss_family; #if TEMP_ADDR @@ -180,7 +182,9 @@ void* y_socket_send_file_for_all_nodes(void* arg){ #endif } } -#endif +#endif + +#if 0 //memset(buf_send, 0, BUF_SIZE+1); retread = sprintf(buf_send, "post file %s", filename); if(sendto(fds[(c_af==AF_INET6)].fd, @@ -196,6 +200,7 @@ void* y_socket_send_file_for_all_nodes(void* arg){ }else{ printf("debug: sending response to < %s >",tempAddr); } +#endif }