Browse Source

close async

ithewei 4 years ago
parent
commit
14b199cb0d
2 changed files with 2 additions and 2 deletions
  1. 1 1
      http/server/HttpHandler.cpp
  2. 1 1
      http/server/HttpResponseWriter.h

+ 1 - 1
http/server/HttpHandler.cpp

@@ -23,7 +23,7 @@ int HttpHandler::invokeHttpHandler(const http_handler* handler) {
         ctx->response = resp;
         ctx->writer = writer;
         status_code = handler->ctx_handler(ctx);
-        if (writer->state != hv::HttpResponseWriter::SEND_BEGIN) {
+        if (writer && writer->state != hv::HttpResponseWriter::SEND_BEGIN) {
             status_code = HTTP_STATUS_UNFINISHED;
         }
     }

+ 1 - 1
http/server/HttpResponseWriter.h

@@ -159,7 +159,7 @@ public:
 
         state = SEND_END;
         if (!response->IsKeepAlive()) {
-            close();
+            close(true);
         }
         return ret;
     }