[Groonga-commit] groonga/groonga [master] httpd: support /d/shutdown

Zurück zum Archiv-Index

null+****@clear***** null+****@clear*****
2012年 6月 22日 (金) 17:39:06 JST


Ryo Onodera	2012-06-22 17:39:06 +0900 (Fri, 22 Jun 2012)

  New Revision: 3854ad2f23e7697e1eebfb14417a1de8eb75dc34
  https://github.com/groonga/groonga/commit/3854ad2f23e7697e1eebfb14417a1de8eb75dc34

  Log:
    httpd: support /d/shutdown

  Modified files:
    src/nginx-module/ngx_http_groonga_module.c

  Modified: src/nginx-module/ngx_http_groonga_module.c (+16 -0)
===================================================================
--- src/nginx-module/ngx_http_groonga_module.c    2012-06-22 17:38:17 +0900 (6961d9f)
+++ src/nginx-module/ngx_http_groonga_module.c    2012-06-22 17:39:06 +0900 (6dadbbb)
@@ -140,6 +140,22 @@ ngx_http_groonga_context_receive_handler(grn_ctx *context,
 
     grn_ctx_recv(context, &result, &result_size, &flags);
 
+    if (flags == GRN_CTX_QUIT) {
+      ngx_int_t ngx_rc;
+      ngx_rc = ngx_os_signal_process((ngx_cycle_t*)ngx_cycle,
+                                     "stop",
+                                     getppid());
+      if (ngx_rc == NGX_OK) {
+        context->stat &= ~GRN_CTX_QUIT;
+        grn_ctx_recv(context, &result, &result_size, &flags);
+        context->stat |= GRN_CTX_QUIT;
+      } else {
+        context->rc = GRN_OPERATION_NOT_PERMITTED;
+        GRN_TEXT_PUTS(context, &output->body, "false");
+        context->stat &= ~GRN_CTX_QUIT;
+      }
+    }
+
     if (result_size || GRN_TEXT_LEN(&output->body) || context->rc) {
       if (!GRN_TEXT_LEN(&output->body)) {
         GRN_TEXT_SET(context,
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-commit メーリングリストの案内
Zurück zum Archiv-Index