nxt_python.c (1932:ee35fc1dca33) nxt_python.c (1980:43553aa72111)
1
2/*
3 * Copyright (C) NGINX, Inc.
4 */
5
6
7#include <Python.h>
8

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

225
226 } else {
227 ret = nxt_python_set_target(task, &targets->target[0], app_conf->self);
228 if (nxt_slow_path(ret != NXT_OK)) {
229 goto fail;
230 }
231 }
232
1
2/*
3 * Copyright (C) NGINX, Inc.
4 */
5
6
7#include <Python.h>
8

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

225
226 } else {
227 ret = nxt_python_set_target(task, &targets->target[0], app_conf->self);
228 if (nxt_slow_path(ret != NXT_OK)) {
229 goto fail;
230 }
231 }
232
233 nxt_unit_default_init(task, &python_init);
233 nxt_unit_default_init(task, &python_init, data->app);
234
235 python_init.data = c;
234
235 python_init.data = c;
236 python_init.shm_limit = data->app->shm_limit;
237 python_init.callbacks.ready_handler = nxt_python_ready_handler;
238
239 proto = c->protocol;
240
241 if (proto.length == 0) {
242 proto = nxt_python_asgi_check(targets->target[0].application)
243 ? asgi : wsgi;
244

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

517static int
518nxt_python_ready_handler(nxt_unit_ctx_t *ctx)
519{
520 int res;
521 uint32_t i;
522 nxt_py_thread_info_t *ti;
523 nxt_python_app_conf_t *c;
524
236 python_init.callbacks.ready_handler = nxt_python_ready_handler;
237
238 proto = c->protocol;
239
240 if (proto.length == 0) {
241 proto = nxt_python_asgi_check(targets->target[0].application)
242 ? asgi : wsgi;
243

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

516static int
517nxt_python_ready_handler(nxt_unit_ctx_t *ctx)
518{
519 int res;
520 uint32_t i;
521 nxt_py_thread_info_t *ti;
522 nxt_python_app_conf_t *c;
523
525 if (nxt_py_proto.ready != NULL) {
526 res = nxt_py_proto.ready(ctx);
527 if (nxt_slow_path(res != NXT_UNIT_OK)) {
528 return NXT_UNIT_ERROR;
529 }
530 }
531
532 /* Worker thread context. */
533 if (!nxt_unit_is_main_ctx(ctx)) {
534 return NXT_UNIT_OK;
535 }
536
537 c = ctx->unit->data;
538
539 if (c->threads <= 1) {
540 return NXT_UNIT_OK;
541 }
542
543 for (i = 0; i < c->threads - 1; i++) {
544 ti = &nxt_py_threads[i];

--- 191 unchanged lines hidden ---
524 c = ctx->unit->data;
525
526 if (c->threads <= 1) {
527 return NXT_UNIT_OK;
528 }
529
530 for (i = 0; i < c->threads - 1; i++) {
531 ti = &nxt_py_threads[i];

--- 191 unchanged lines hidden ---