Browse Source

Added MG_SHUTDOWN event

Sergey Lyubka 13 years ago
parent
commit
15a0d819ed
2 changed files with 3 additions and 1 deletions
  1. 1 0
      mongoose.c
  2. 2 1
      mongoose.h

+ 1 - 0
mongoose.c

@@ -4303,6 +4303,7 @@ static void free_context(struct mg_context *ctx) {
 }
 }
 
 
 void mg_stop(struct mg_context *ctx) {
 void mg_stop(struct mg_context *ctx) {
+  call_user(fc(ctx), MG_SHUTDOWN);
   ctx->stop_flag = 1;
   ctx->stop_flag = 1;
 
 
   // Wait until mg_fini() stops
   // Wait until mg_fini() stops

+ 2 - 1
mongoose.h

@@ -59,7 +59,8 @@ enum mg_event {
   MG_EVENT_LOG,     // Mongoose logs an event, request_info.log_message
   MG_EVENT_LOG,     // Mongoose logs an event, request_info.log_message
   MG_INIT_SSL,      // Mongoose initializes SSL. Instead of mg_connection *,
   MG_INIT_SSL,      // Mongoose initializes SSL. Instead of mg_connection *,
                     // SSL context is passed to the callback function.
                     // SSL context is passed to the callback function.
-  MG_REQUEST_COMPLETE  // Mongoose has finished handling the request
+  MG_REQUEST_COMPLETE,  // Mongoose has finished handling the request
+  MG_SHUTDOWN       // Called when Mongoose stops, request_info is empty.
 };
 };
 
 
 // Prototype for the user-defined function. Mongoose calls this function
 // Prototype for the user-defined function. Mongoose calls this function