mirror of https://github.com/yandex/odyssey.git
odissey: make router pooler coroutine
This commit is contained in:
parent
667bbf0ade
commit
1415ecc03f
|
@ -1 +1 @@
|
|||
Subproject commit f84548fe783356568de956131049692b9f41d410
|
||||
Subproject commit e65804541052244b17677c8b037ae37e0b389baf
|
|
@ -36,8 +36,10 @@
|
|||
#include "od_client_pool.h"
|
||||
#include "od_route_id.h"
|
||||
#include "od_route.h"
|
||||
#include "od_route_pool.h"
|
||||
#include "od_io.h"
|
||||
|
||||
#include "od_router.h"
|
||||
#include "od_pooler.h"
|
||||
#include "od_relay.h"
|
||||
#include "od_frontend.h"
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include "od_route_pool.h"
|
||||
#include "od_io.h"
|
||||
|
||||
#include "od_pooler.h"
|
||||
#include "od_router.h"
|
||||
#include "od_pooler.h"
|
||||
#include "od_relay.h"
|
||||
#include "od_frontend.h"
|
||||
#include "od_backend.h"
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include "od_route_pool.h"
|
||||
#include "od_io.h"
|
||||
|
||||
#include "od_pooler.h"
|
||||
#include "od_router.h"
|
||||
#include "od_pooler.h"
|
||||
#include "od_relay.h"
|
||||
#include "od_frontend.h"
|
||||
#include "od_backend.h"
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include "od_route_pool.h"
|
||||
#include "od_io.h"
|
||||
|
||||
#include "od_pooler.h"
|
||||
#include "od_router.h"
|
||||
#include "od_pooler.h"
|
||||
#include "od_relay.h"
|
||||
#include "od_frontend.h"
|
||||
#include "od_backend.h"
|
||||
|
@ -488,7 +488,10 @@ void od_frontend(void *arg)
|
|||
od_log_client(&instance->log, client->id, NULL,
|
||||
"disconnected (read/write error): %s",
|
||||
machine_error(client->io));
|
||||
|
||||
if (! client->server) {
|
||||
od_unroute(client);
|
||||
break;
|
||||
}
|
||||
rc = od_backend_reset(server);
|
||||
if (rc != 1) {
|
||||
/* close backend connection */
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include "od_route_pool.h"
|
||||
#include "od_io.h"
|
||||
|
||||
#include "od_pooler.h"
|
||||
#include "od_router.h"
|
||||
#include "od_pooler.h"
|
||||
#include "od_relay.h"
|
||||
#include "od_relay_pool.h"
|
||||
#include "od_frontend.h"
|
||||
|
@ -158,13 +158,10 @@ int od_instance_main(od_instance_t *instance, int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
od_pooler_init(&pooler, &system);
|
||||
rc = od_pooler_start(&pooler);
|
||||
if (rc == -1)
|
||||
return 1;
|
||||
|
||||
od_router_init(&router, &system);
|
||||
rc = od_router_start(&router);
|
||||
od_pooler_init(&pooler, &system);
|
||||
|
||||
rc = od_pooler_start(&pooler);
|
||||
if (rc == -1)
|
||||
return 1;
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include "od_route_pool.h"
|
||||
#include "od_io.h"
|
||||
|
||||
#include "od_pooler.h"
|
||||
#include "od_router.h"
|
||||
#include "od_pooler.h"
|
||||
#include "od_relay.h"
|
||||
#include "od_frontend.h"
|
||||
#include "od_backend.h"
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#include "od_client_pool.h"
|
||||
#include "od_route_id.h"
|
||||
#include "od_route.h"
|
||||
#include "od_route_pool.h"
|
||||
#include "od_router.h"
|
||||
#include "od_pooler.h"
|
||||
#include "od_tls.h"
|
||||
|
||||
|
@ -42,12 +44,18 @@ static inline void
|
|||
od_pooler(void *arg)
|
||||
{
|
||||
od_pooler_t *pooler = arg;
|
||||
od_router_t *router = pooler->system->router;
|
||||
od_instance_t *instance = pooler->system->instance;
|
||||
|
||||
od_log(&instance->log, "pooler: started");
|
||||
|
||||
/* init pooler tls */
|
||||
/* start router coroutine */
|
||||
int rc;
|
||||
rc = od_router_start(router);
|
||||
if (rc == -1)
|
||||
return;
|
||||
|
||||
/* init pooler tls */
|
||||
pooler->tls = NULL;
|
||||
od_scheme_t *scheme = &instance->scheme;
|
||||
if (scheme->tls_verify != OD_TDISABLE) {
|
||||
|
|
|
@ -36,7 +36,9 @@
|
|||
#include "od_client_pool.h"
|
||||
#include "od_route_id.h"
|
||||
#include "od_route.h"
|
||||
#include "od_route_pool.h"
|
||||
|
||||
#include "od_router.h"
|
||||
#include "od_pooler.h"
|
||||
#include "od_relay.h"
|
||||
#include "od_frontend.h"
|
||||
|
|
|
@ -36,7 +36,9 @@
|
|||
#include "od_client_pool.h"
|
||||
#include "od_route_id.h"
|
||||
#include "od_route.h"
|
||||
#include "od_route_pool.h"
|
||||
|
||||
#include "od_router.h"
|
||||
#include "od_pooler.h"
|
||||
#include "od_relay.h"
|
||||
#include "od_relay_pool.h"
|
||||
|
|
|
@ -39,9 +39,9 @@
|
|||
#include "od_route_pool.h"
|
||||
#include "od_io.h"
|
||||
|
||||
#include "od_router.h"
|
||||
#include "od_pooler.h"
|
||||
#include "od_relay.h"
|
||||
#include "od_router.h"
|
||||
#include "od_frontend.h"
|
||||
#include "od_backend.h"
|
||||
#include "od_cancel.h"
|
||||
|
@ -344,7 +344,6 @@ int od_router_init(od_router_t *router, od_system_t *system)
|
|||
{
|
||||
od_instance_t *instance = system->instance;
|
||||
od_routepool_init(&router->route_pool);
|
||||
router->machine = -1;
|
||||
router->system = system;
|
||||
router->server_seq = 0;
|
||||
router->queue = machine_queue_create();
|
||||
|
@ -358,8 +357,9 @@ int od_router_init(od_router_t *router, od_system_t *system)
|
|||
int od_router_start(od_router_t *router)
|
||||
{
|
||||
od_instance_t *instance = router->system->instance;
|
||||
router->machine = machine_create("router", od_router, router);
|
||||
if (router->machine == -1) {
|
||||
int64_t coroutine_id;
|
||||
coroutine_id = machine_coroutine_create(od_router, router);
|
||||
if (coroutine_id == -1) {
|
||||
od_error(&instance->log, "failed to start router");
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ typedef enum
|
|||
|
||||
struct od_router
|
||||
{
|
||||
int64_t machine;
|
||||
od_routepool_t route_pool;
|
||||
machine_queue_t queue;
|
||||
uint64_t server_seq;
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include "od_route_pool.h"
|
||||
#include "od_io.h"
|
||||
|
||||
#include "od_pooler.h"
|
||||
#include "od_router.h"
|
||||
#include "od_pooler.h"
|
||||
#include "od_relay.h"
|
||||
#include "od_tls.h"
|
||||
|
||||
|
|
Loading…
Reference in New Issue