odissey: do not reconfigure previously owned servers

This commit is contained in:
Dmitry Simonenko 2017-06-09 15:30:53 +03:00
parent 5a7e76c8d2
commit 9dff1d7a5a
3 changed files with 18 additions and 6 deletions

View File

@ -291,10 +291,17 @@ od_frontend_main(od_client_t *client)
"attached to S%" PRIu64,
server->id);
/* configure server using client startup parameters */
rc = od_backend_configure(client->server, &client->startup);
if (rc == -1)
return OD_RS_ESERVER_CONFIGURE;
/* configure server using client startup parameters,
* if it has not been configured before. */
if (server->last_client_id == client->id) {
od_debug_client(&instance->log, client->id, NULL,
"previously owned, no need to reconfigure S%" PRIu64,
server->id);
} else {
rc = od_backend_configure(client->server, &client->startup);
if (rc == -1)
return OD_RS_ESERVER_CONFIGURE;
}
}
rc = od_write(server->io, stream);

View File

@ -330,7 +330,9 @@ od_router(void *arg)
od_client_t *client = msg_detach->client;
od_route_t *route = client->route;
od_server_t *server = client->server;
client->server = NULL;
server->last_client_id = client->id;
od_serverpool_set(&route->server_pool, server, OD_SIDLE);
od_clientpool_set(&route->client_pool, client, OD_CPENDING);
@ -353,10 +355,11 @@ od_router(void *arg)
od_route_t *route = client->route;
od_server_t *server = client->server;
od_serverpool_set(&route->server_pool, server, OD_SIDLE);
od_clientpool_set(&route->client_pool, client, OD_CUNDEF);
server->last_client_id = client->id;
client->server = NULL;
client->route = NULL;
od_serverpool_set(&route->server_pool, server, OD_SIDLE);
od_clientpool_set(&route->client_pool, client, OD_CUNDEF);
/* wakeup attachers */
od_router_wakeup(router, route);

View File

@ -33,6 +33,7 @@ struct od_server
int idle_time;
so_key_t key;
so_key_t key_client;
uint64_t last_client_id;
void *route;
od_system_t *system;
od_list_t link;
@ -56,6 +57,7 @@ od_server_init(od_server_t *server)
server->is_allocated = 0;
server->is_transaction = 0;
server->is_copy = 0;
server->last_client_id = UINT64_MAX;
server->count_request = 0;
server->count_reply = 0;
so_keyinit(&server->key);