Deleted
Added
nxt_application.c (112:6f1809436b10) | nxt_application.c (141:96a65c601420) |
---|---|
1 2/* 3 * Copyright (C) Max Romanov 4 * Copyright (C) Igor Sysoev 5 * Copyright (C) Valentin V. Bartenev 6 * Copyright (C) NGINX, Inc. 7 */ 8 9#include <nxt_main.h> 10#include <nxt_runtime.h> 11#include <nxt_application.h> | 1 2/* 3 * Copyright (C) Max Romanov 4 * Copyright (C) Igor Sysoev 5 * Copyright (C) Valentin V. Bartenev 6 * Copyright (C) NGINX, Inc. 7 */ 8 9#include <nxt_main.h> 10#include <nxt_runtime.h> 11#include <nxt_application.h> |
12#include <nxt_master_process.h> |
|
12 13 | 13 14 |
14nxt_application_module_t *nxt_app; | 15nxt_application_module_t *nxt_app_modules[NXT_APP_MAX]; |
15 16static nxt_thread_mutex_t nxt_app_mutex; 17static nxt_thread_cond_t nxt_app_cond; 18 19static nxt_http_fields_hash_entry_t nxt_app_request_fields[]; | 16 17static nxt_thread_mutex_t nxt_app_mutex; 18static nxt_thread_cond_t nxt_app_cond; 19 20static nxt_http_fields_hash_entry_t nxt_app_request_fields[]; |
20static nxt_http_fields_hash_t *nxt_app_request_fields_hash; | 21static nxt_http_fields_hash_t *nxt_app_request_fields_hash; |
21 | 22 |
23static nxt_application_module_t *nxt_app; 24 |
|
22nxt_int_t | 25nxt_int_t |
23nxt_app_start(nxt_task_t *task, nxt_runtime_t *rt) | 26nxt_app_start(nxt_task_t *task, void *data) |
24{ | 27{ |
28 nxt_int_t ret; 29 nxt_common_app_conf_t *app_conf; 30 31 app_conf = data; 32 |
|
25 if (nxt_slow_path(nxt_thread_mutex_create(&nxt_app_mutex) != NXT_OK)) { 26 return NXT_ERROR; 27 } 28 29 if (nxt_slow_path(nxt_thread_cond_create(&nxt_app_cond) != NXT_OK)) { 30 return NXT_ERROR; 31 } 32 | 33 if (nxt_slow_path(nxt_thread_mutex_create(&nxt_app_mutex) != NXT_OK)) { 34 return NXT_ERROR; 35 } 36 37 if (nxt_slow_path(nxt_thread_cond_create(&nxt_app_cond) != NXT_OK)) { 38 return NXT_ERROR; 39 } 40 |
33 if (nxt_slow_path(nxt_app->init(task) != NXT_OK)) { | 41 nxt_app = nxt_app_modules[app_conf->type_id]; 42 43 ret = nxt_app->init(task, data); 44 45 if (nxt_slow_path(ret != NXT_OK)) { |
34 nxt_debug(task, "application init failed"); | 46 nxt_debug(task, "application init failed"); |
47 48 } else { 49 nxt_debug(task, "application init done"); |
|
35 } 36 | 50 } 51 |
37 return NXT_OK; | 52 return ret; |
38} 39 40 41nxt_int_t 42nxt_app_http_init(nxt_task_t *task, nxt_runtime_t *rt) 43{ 44 nxt_http_fields_hash_t *hash; 45 --- 519 unchanged lines hidden (view full) --- 565 566 nxt_memcpy(dst, c, size); 567 568 nxt_debug(task, "nxt_app_msg_write_raw: %d %*s", (int)size, 569 (int)size, c); 570 571 return NXT_OK; 572} | 53} 54 55 56nxt_int_t 57nxt_app_http_init(nxt_task_t *task, nxt_runtime_t *rt) 58{ 59 nxt_http_fields_hash_t *hash; 60 --- 519 unchanged lines hidden (view full) --- 580 581 nxt_memcpy(dst, c, size); 582 583 nxt_debug(task, "nxt_app_msg_write_raw: %d %*s", (int)size, 584 (int)size, c); 585 586 return NXT_OK; 587} |
588 589 590nxt_app_type_t 591nxt_app_parse_type(nxt_str_t *str) 592{ 593 if (nxt_str_eq(str, "python", 6)) { 594 return NXT_APP_PYTHON; 595 596 } else if (nxt_str_eq(str, "python2", 7)) { 597 return NXT_APP_PYTHON2; 598 599 } else if (nxt_str_eq(str, "python3", 7)) { 600 return NXT_APP_PYTHON3; 601 602 } else if (nxt_str_eq(str, "php", 3)) { 603 return NXT_APP_PHP; 604 605 } else if (nxt_str_eq(str, "php5", 4)) { 606 return NXT_APP_PHP5; 607 608 } else if (nxt_str_eq(str, "php7", 4)) { 609 return NXT_APP_PHP7; 610 611 } else if (nxt_str_eq(str, "ruby", 4)) { 612 return NXT_APP_RUBY; 613 614 } else if (nxt_str_eq(str, "go", 2)) { 615 return NXT_APP_GO; 616 617 } 618 619 return NXT_APP_UNKNOWN; 620} |
|