)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"38e44017c3864ef1230c2358215949a0d9e16637","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"7f3b0002_8c177924","updated":"2022-03-04 20:06:55.000000000","message":"just minor comments ","commit_id":"39593bb47c93ac5ea60c95cb2a89589eed4346fe"}],"src/server/server.h":[{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"38e44017c3864ef1230c2358215949a0d9e16637","unresolved":true,"context_lines":[{"line_number":56,"context_line":"};"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"struct service_driver {"},{"line_number":59,"context_line":"\t/** the name of the server */"},{"line_number":60,"context_line":"\tconst char *name;"},{"line_number":61,"context_line":"\t/** optional minimal setup to accept a connection during keep-alive */"},{"line_number":62,"context_line":"\tint (*new_connection_during_keep_alive_handler)(struct connection *connection);"},{"line_number":63,"context_line":"\t/**"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"6b052643_a368f2e0","line":60,"range":{"start_line":59,"start_character":1,"end_line":60,"end_character":18},"updated":"2022-03-04 20:06:55.000000000","message":"I prefer if we keep the server or service name out of the driver\nGiving the example of semihosting, keeping this struct will block me of creating services named like the following : \n - STM32H7.cm7 semihsoting service\n - STM32H7.cm0 ....","commit_id":"39593bb47c93ac5ea60c95cb2a89589eed4346fe"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"512cf3402ea3cfc1c62090b60654e0751aebff6a","unresolved":false,"context_lines":[{"line_number":56,"context_line":"};"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"struct service_driver {"},{"line_number":59,"context_line":"\t/** the name of the server */"},{"line_number":60,"context_line":"\tconst char *name;"},{"line_number":61,"context_line":"\t/** optional minimal setup to accept a connection during keep-alive */"},{"line_number":62,"context_line":"\tint (*new_connection_during_keep_alive_handler)(struct connection *connection);"},{"line_number":63,"context_line":"\t/**"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"0297549a_ce63f9c0","line":60,"range":{"start_line":59,"start_character":1,"end_line":60,"end_character":18},"in_reply_to":"299ff2ca_1162512f","updated":"2022-03-07 10:08:28.000000000","message":"Ack","commit_id":"39593bb47c93ac5ea60c95cb2a89589eed4346fe"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a66166570ff98c1d08bc31e6a540b7dc988f26a5","unresolved":true,"context_lines":[{"line_number":56,"context_line":"};"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"struct service_driver {"},{"line_number":59,"context_line":"\t/** the name of the server */"},{"line_number":60,"context_line":"\tconst char *name;"},{"line_number":61,"context_line":"\t/** optional minimal setup to accept a connection during keep-alive */"},{"line_number":62,"context_line":"\tint (*new_connection_during_keep_alive_handler)(struct connection *connection);"},{"line_number":63,"context_line":"\t/**"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"299ff2ca_1162512f","line":60,"range":{"start_line":59,"start_character":1,"end_line":60,"end_character":18},"in_reply_to":"6b052643_a368f2e0","updated":"2022-03-04 22:35:06.000000000","message":"If I understand correctly what you want to do, you can still do it!\nIn the trivial cases used in this patch the struct service_driver is const.\nBut the content of struct service_driver is fully copied inside add_service(), so it can be dynamically allocated in the stack of the caller. E.g.\n\nstruct service_driver a;\na.name \u003d alloc_printf(\"%s semihosting service\", name);\na.input_handler \u003d my_input_handler;\na.new_connection_handler \u003d test ? new1 : new_2;\n...\nretval \u003d add_service(\u0026a, ...);","commit_id":"39593bb47c93ac5ea60c95cb2a89589eed4346fe"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"38e44017c3864ef1230c2358215949a0d9e16637","unresolved":true,"context_lines":[{"line_number":84,"context_line":"\tstruct sockaddr_in sin;"},{"line_number":85,"context_line":"\tint max_connections;"},{"line_number":86,"context_line":"\tstruct connection *connections;"},{"line_number":87,"context_line":"\tint (*new_connection_during_keep_alive)(struct connection *connection);"},{"line_number":88,"context_line":"\tint (*new_connection)(struct connection *connection);"},{"line_number":89,"context_line":"\tint (*input)(struct connection *connection);"},{"line_number":90,"context_line":"\tint (*connection_closed)(struct connection *connection);"},{"line_number":91,"context_line":"\tvoid (*keep_client_alive)(struct connection *connection);"},{"line_number":92,"context_line":"\tvoid *priv;"},{"line_number":93,"context_line":"\tstruct service *next;"},{"line_number":94,"context_line":"};"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"802801ae_ff6af71a","line":91,"range":{"start_line":87,"start_character":0,"end_line":91,"end_character":58},"updated":"2022-03-04 20:06:55.000000000","message":"isn\u0027t better to user service driver here ?","commit_id":"39593bb47c93ac5ea60c95cb2a89589eed4346fe"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"512cf3402ea3cfc1c62090b60654e0751aebff6a","unresolved":true,"context_lines":[{"line_number":84,"context_line":"\tstruct sockaddr_in sin;"},{"line_number":85,"context_line":"\tint max_connections;"},{"line_number":86,"context_line":"\tstruct connection *connections;"},{"line_number":87,"context_line":"\tint (*new_connection_during_keep_alive)(struct connection *connection);"},{"line_number":88,"context_line":"\tint (*new_connection)(struct connection *connection);"},{"line_number":89,"context_line":"\tint (*input)(struct connection *connection);"},{"line_number":90,"context_line":"\tint (*connection_closed)(struct connection *connection);"},{"line_number":91,"context_line":"\tvoid (*keep_client_alive)(struct connection *connection);"},{"line_number":92,"context_line":"\tvoid *priv;"},{"line_number":93,"context_line":"\tstruct service *next;"},{"line_number":94,"context_line":"};"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"b182b1b0_7c8d74aa","line":91,"range":{"start_line":87,"start_character":0,"end_line":91,"end_character":58},"in_reply_to":"802801ae_ff6af71a","updated":"2022-03-07 10:08:28.000000000","message":"and what about this one :\nisn\u0027t better to use service_driver here ?","commit_id":"39593bb47c93ac5ea60c95cb2a89589eed4346fe"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"0add66ce12a77aa50a97cd0a3cf146c1c0a5966a","unresolved":true,"context_lines":[{"line_number":84,"context_line":"\tstruct sockaddr_in sin;"},{"line_number":85,"context_line":"\tint max_connections;"},{"line_number":86,"context_line":"\tstruct connection *connections;"},{"line_number":87,"context_line":"\tint (*new_connection_during_keep_alive)(struct connection *connection);"},{"line_number":88,"context_line":"\tint (*new_connection)(struct connection *connection);"},{"line_number":89,"context_line":"\tint (*input)(struct connection *connection);"},{"line_number":90,"context_line":"\tint (*connection_closed)(struct connection *connection);"},{"line_number":91,"context_line":"\tvoid (*keep_client_alive)(struct connection *connection);"},{"line_number":92,"context_line":"\tvoid *priv;"},{"line_number":93,"context_line":"\tstruct service *next;"},{"line_number":94,"context_line":"};"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"fbec5caa_29b08f26","line":91,"range":{"start_line":87,"start_character":0,"end_line":91,"end_character":58},"in_reply_to":"b182b1b0_7c8d74aa","updated":"2022-03-07 10:45:45.000000000","message":"We will not use a pointer to struct service_driver, otherwise we would force the caller of add_service() to pass a static const struct, and this is not what you asked above.\nWe will have to memcpy() the struct content and still need to strdup(-\u003ename). Or move name away of the struct and pass it as add_service() argument but still use strdup().\nAnd all calls connection-\u003emethod() has to be rewritten connection-\u003eops.method().\nFor the moment I don\u0027t see big advantages.","commit_id":"39593bb47c93ac5ea60c95cb2a89589eed4346fe"}]}
