nxt_router.c (351:92038a9f4937) nxt_router.c (352:47649fbbcb53)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_router.h>

--- 578 unchanged lines hidden (view full) ---

587
588 nxt_port_rpc_handler(task, msg);
589}
590
591
592void
593nxt_router_conf_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
594{
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_router.h>

--- 578 unchanged lines hidden (view full) ---

587
588 nxt_port_rpc_handler(task, msg);
589}
590
591
592void
593nxt_router_conf_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
594{
595 size_t dump_size;
596 nxt_int_t ret;
597 nxt_buf_t *b;
598 nxt_router_temp_conf_t *tmcf;
599
595 nxt_int_t ret;
596 nxt_buf_t *b;
597 nxt_router_temp_conf_t *tmcf;
598
600 b = msg->buf;
601
602 dump_size = nxt_buf_used_size(b);
603
604 if (dump_size > 300) {
605 dump_size = 300;
606 }
607
608 nxt_debug(task, "router conf data (%z): %*s",
609 msg->size, dump_size, b->mem.pos);
610
611 tmcf = nxt_router_temp_conf(task);
612 if (nxt_slow_path(tmcf == NULL)) {
613 return;
614 }
615
599 tmcf = nxt_router_temp_conf(task);
600 if (nxt_slow_path(tmcf == NULL)) {
601 return;
602 }
603
604 b = nxt_buf_chk_make_plain(tmcf->conf->mem_pool, msg->buf, msg->size);
605
606 nxt_assert(b != NULL);
607
616 tmcf->conf->router = nxt_router;
617 tmcf->stream = msg->port_msg.stream;
618 tmcf->port = nxt_runtime_port_find(task->thread->runtime,
619 msg->port_msg.pid,
620 msg->port_msg.reply_port);
621
622 ret = nxt_router_conf_create(task, tmcf, b->mem.pos, b->mem.free);
623

--- 813 unchanged lines hidden (view full) ---

1437 nxt_string("ListenerInUse"),
1438 nxt_string("ListenerNoAddress"),
1439 nxt_string("ListenerNoAccess"),
1440 nxt_string("ListenerPath"),
1441 };
1442
1443 rpc = data;
1444 sa = rpc->socket_conf->sockaddr;
608 tmcf->conf->router = nxt_router;
609 tmcf->stream = msg->port_msg.stream;
610 tmcf->port = nxt_runtime_port_find(task->thread->runtime,
611 msg->port_msg.pid,
612 msg->port_msg.reply_port);
613
614 ret = nxt_router_conf_create(task, tmcf, b->mem.pos, b->mem.free);
615

--- 813 unchanged lines hidden (view full) ---

1429 nxt_string("ListenerInUse"),
1430 nxt_string("ListenerNoAddress"),
1431 nxt_string("ListenerNoAccess"),
1432 nxt_string("ListenerPath"),
1433 };
1434
1435 rpc = data;
1436 sa = rpc->socket_conf->sockaddr;
1437 tmcf = rpc->temp_conf;
1445
1438
1446 in = msg->buf;
1439 in = nxt_buf_chk_make_plain(tmcf->mem_pool, msg->buf, msg->size);
1440
1441 nxt_assert(in != NULL);
1442
1447 p = in->mem.pos;
1448
1449 error = *p++;
1450
1451 size = sizeof("listen socket error: ") - 1
1452 + sizeof("{listener: \"\", code:\"\", message: \"\"}") - 1
1453 + sa->length + socket_errors[error].length + (in->mem.free - p);
1454
1443 p = in->mem.pos;
1444
1445 error = *p++;
1446
1447 size = sizeof("listen socket error: ") - 1
1448 + sizeof("{listener: \"\", code:\"\", message: \"\"}") - 1
1449 + sa->length + socket_errors[error].length + (in->mem.free - p);
1450
1455 tmcf = rpc->temp_conf;
1456
1457 out = nxt_buf_mem_alloc(tmcf->mem_pool, size, 0);
1458 if (nxt_slow_path(out == NULL)) {
1459 return;
1460 }
1461
1462 out->mem.free = nxt_sprintf(out->mem.free, out->mem.end,
1463 "listen socket error: "
1464 "{listener: \"%*s\", code:\"%V\", message: \"%*s\"}",

--- 2214 unchanged lines hidden ---
1451 out = nxt_buf_mem_alloc(tmcf->mem_pool, size, 0);
1452 if (nxt_slow_path(out == NULL)) {
1453 return;
1454 }
1455
1456 out->mem.free = nxt_sprintf(out->mem.free, out->mem.end,
1457 "listen socket error: "
1458 "{listener: \"%*s\", code:\"%V\", message: \"%*s\"}",

--- 2214 unchanged lines hidden ---