y_socket: change buf send file

This commit is contained in:
2025-09-03 08:22:37 +02:00
parent 8189f76c16
commit 803388d7b8
+8 -3
View File
@@ -121,11 +121,13 @@ void* y_socket_send_file_for_all_nodes(void* arg){
return NULL; return NULL;
} }
int len_header = sprintf(buf_send, "post file %s :",filename);
//y_send_post_file_to_all_nodes(arg); //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 ){ //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); //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'; buf_send[retread]='\0';
//memset(msgRet, 0, BUF_SIZE + NI_MAXHOST + NI_MAXSERV + 100); //memset(msgRet, 0, BUF_SIZE + NI_MAXHOST + NI_MAXSERV + 100);
// sprintf(msgRet, "from %s:%s =%s",host, service, buf); // 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); ///printf("debug: sending response %s :\n",buf_send);
//FOR_LIST_FORM_BEGIN(y_NODE_T, nodes) //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); //memset(tempAddr, 0, BUF_SIZE+1);
c_af=(local_list_current->value).addr.ss_family; c_af=(local_list_current->value).addr.ss_family;
#if TEMP_ADDR #if TEMP_ADDR
@@ -181,6 +183,8 @@ void* y_socket_send_file_for_all_nodes(void* arg){
} }
} }
#endif #endif
#if 0
//memset(buf_send, 0, BUF_SIZE+1); //memset(buf_send, 0, BUF_SIZE+1);
retread = sprintf(buf_send, "post file %s", filename); retread = sprintf(buf_send, "post file %s", filename);
if(sendto(fds[(c_af==AF_INET6)].fd, if(sendto(fds[(c_af==AF_INET6)].fd,
@@ -196,6 +200,7 @@ void* y_socket_send_file_for_all_nodes(void* arg){
}else{ }else{
printf("debug: sending response to < %s >",tempAddr); printf("debug: sending response to < %s >",tempAddr);
} }
#endif
} }