Mercurial > hg > nginx
view src/os/win32/ngx_service.c @ 563:9c2f3ed7a247 release-0.3.3
nginx-0.3.3-RELEASE import
*) Change: the "bl" and "af" parameters of the "listen" directive was
renamed to the "backlog" and "accept_filter".
*) Feature: the "rcvbuf" and "sndbuf" parameters of the "listen"
directive.
*) Change: the "$msec" log parameter does not require now the
additional the gettimeofday() system call.
*) Feature: the -t switch now tests the "listen" directives.
*) Bugfix: if the invalid address was specified in the "listen"
directive, then after the -HUP signal nginx left an open socket in
the CLOSED state.
*) Bugfix: the mime type may be incorrectly set to default value for
index file with variable in the name; the bug had appeared in 0.3.0.
*) Feature: the "timer_resolution" directive.
*) Feature: the millisecond "$upstream_response_time" log parameter.
*) Bugfix: a temporary file with client request body now is removed
just after the response header was transferred to a client.
*) Bugfix: OpenSSL 0.9.6 compatibility.
*) Bugfix: the SSL certificate and key file paths could not be relative.
*) Bugfix: the "ssl_prefer_server_ciphers" directive did not work in
the ngx_imap_ssl_module.
*) Bugfix: the "ssl_protocols" directive allowed to specify the single
protocol only.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 19 Oct 2005 12:33:58 +0000 |
parents | 42d11f017717 |
children | d620f497c50f |
line wrap: on
line source
/* * Copyright (C) Igor Sysoev */ #define NGX_SERVICE_CONTROL_SHUTDOWN 128 #define NGX_SERVICE_CONTROL_REOPEN 129 SERVICE_TABLE_ENTRY st[] = { { "nginx", service_main }, { NULL, NULL } }; ngx_int_t ngx_service(ngx_log_t *log) { /* primary thread */ /* StartServiceCtrlDispatcher() shouxpdl be called within 30 seconds */ if (StartServiceCtrlDispatcher(st) == 0) { ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "StartServiceCtrlDispatcher() failed"); return NGX_ERROR; } return NGX_OK; } void service_main(u_int argc, char **argv) { SERVICE_STATUS status; SERVICE_STATUS_HANDLE service; /* thread spawned by SCM */ service = RegisterServiceCtrlHandlerEx("nginx", service_handler, ctx); if (service == INVALID_HANDLE_VALUE) { ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "RegisterServiceCtrlHandlerEx() failed"); return; } status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; status.dwCurrentState = SERVICE_START_PENDING; status.dwControlsAccepted = SERVICE_ACCEPT_STOP |SERVICE_ACCEPT_PARAMCHANGE; status.dwWin32ExitCode = NO_ERROR; status.dwServiceSpecificExitCode = 0; status.dwCheckPoint = 1; status.dwWaitHint = 2000; /* SetServiceStatus() should be called within 80 seconds */ if (SetServiceStatus(service, &status) == 0) { ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "SetServiceStatus() failed"); return; } /* init */ status.dwCurrentState = SERVICE_RUNNING; status.dwCheckPoint = 0; status.dwWaitHint = 0; if (SetServiceStatus(service, &status) == 0) { ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "SetServiceStatus() failed"); return; } /* call master or worker loop */ /* * master should use event notification and look status * single should use iocp to get notifications from service handler */ } u_int service_handler(u_int control, u_int type, void *data, void *ctx) { /* primary thread */ switch(control) { case SERVICE_CONTROL_INTERROGATE: status = NGX_IOCP_INTERROGATE; break; case SERVICE_CONTROL_STOP: status = NGX_IOCP_STOP; break; case SERVICE_CONTROL_PARAMCHANGE: status = NGX_IOCP_RECONFIGURE; break; case NGX_SERVICE_CONTROL_SHUTDOWN: status = NGX_IOCP_REOPEN; break; case NGX_SERVICE_CONTROL_REOPEN: status = NGX_IOCP_REOPEN; break; default: return ERROR_CALL_NOT_IMPLEMENTED; } if (ngx_single) { if (PostQueuedCompletionStatus(iocp, ... status, ...) == 0) { err = ngx_errno; ngx_log_error(NGX_LOG_ALERT, log, err, "PostQueuedCompletionStatus() failed"); return err; } } else { Event } return NO_ERROR; }