y_socket: add usage_cmd

This commit is contained in:
2025-10-18 10:13:41 +02:00
parent 61f977c32a
commit 6c643f0792
3 changed files with 22 additions and 0 deletions
@@ -41,4 +41,6 @@ size_t total_size_list_y_ptr_STRING(struct main_list_y_ptr_STRING *mstr);
size_t copy_list_y_ptr_STRING_to_one_string(char **p_dst_str, struct main_list_y_ptr_STRING *mstr);
struct main_list_y_ptr_STRING * split_str_to_main_list_y_ptr_STRING(char *str_org, char sep, size_t limit_size_str_org);
void usage_cmdl();
#endif /* Y_PTR_VAR_TOOL_H__C */
@@ -164,3 +164,22 @@ struct main_list_y_ptr_STRING * split_str_to_main_list_y_ptr_STRING(char *str_or
return m_str;
}
void usage_cmdl(){
printf("usage:\n"
"sendto [addr] { \"cmd\" : \"[command]\" }\n"
"addr: ipv4 address or ipv6 address or all to send cmd to all nodes already in the list.\n"
"command: \n"
"\tupdate kill: to gracefully shutdown socket server.\n"
"\tupdate standby: to suspend all workers, but can receive all task but in queu tasks.\n"
"\tupdate wakeup: to wakeup all workers, and then execute all tasks in queu.\n"
"\tupdate remove node [addr]: to remove [addr] in the list.\n"
"\tupdate add node [addr]: to add [addr] in the list.\n"
"\tget file [filename]: to ask server to send file named [filename].\n"
"\t\tfilename can be absolute path or relative working directory path\n"
"\tpost file [filename] : to send file [filename] after header.\n"
"\t\tNeed to add \"seq\" and \"tm\" keys to have good handling, the payload is after the header {}\n"
"\t\tSee y_socket_send_file_for_node function.\n"
"\tpost ok [filenameid]: to acknowledge receipt [filename].\n"
"\t\t[filenameid] is to precise witch [filename] (file name from whom and when)\n"
);
}
+1
View File
@@ -383,6 +383,7 @@ void handle_buf_socket_rec(struct main_list_y_ptr_HEADER_T *m_ok_head_l_t, struc
}
void *y_socket_poll_fds(void *arg){
usage_cmdl();
struct y_socket_t * argSock = (struct y_socket_t*)arg;
// // //
struct main_list_ptr_y_WORKER_T * workers = create_var_list_ptr_y_WORKER_T();