forked from auracaster/openocd
server: change prototype of add_service()
To easily add new methods to a service, pass all the methods through a struct. While there, drop the typedef for the methods and add currently unused new methods to support keep-alive and connections during keep-alive. No change in functionality. Change-Id: I2b5e7140db95021f6e7201e9d631ee340c60b453 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6838 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
This commit is contained in:
@@ -3657,6 +3657,15 @@ static int gdb_input(struct connection *connection)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static const struct service_driver gdb_service_driver = {
|
||||
.name = "gdb",
|
||||
.new_connection_during_keep_alive_handler = NULL,
|
||||
.new_connection_handler = gdb_new_connection,
|
||||
.input_handler = gdb_input,
|
||||
.connection_closed_handler = gdb_connection_closed,
|
||||
.keep_client_alive_handler = NULL,
|
||||
};
|
||||
|
||||
static int gdb_target_start(struct target *target, const char *port)
|
||||
{
|
||||
struct gdb_service *gdb_service;
|
||||
@@ -3673,9 +3682,7 @@ static int gdb_target_start(struct target *target, const char *port)
|
||||
gdb_service->core[1] = -1;
|
||||
target->gdb_service = gdb_service;
|
||||
|
||||
ret = add_service("gdb",
|
||||
port, target->gdb_max_connections, &gdb_new_connection, &gdb_input,
|
||||
&gdb_connection_closed, gdb_service);
|
||||
ret = add_service(&gdb_service_driver, port, target->gdb_max_connections, gdb_service);
|
||||
/* initialize all targets gdb service with the same pointer */
|
||||
{
|
||||
struct target_list *head;
|
||||
|
||||
Reference in New Issue
Block a user