浏览代码

Reset user connection data when closing the connection

bel2125 8 年之前
父节点
当前提交
125cc06a8b
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/civetweb.c

+ 5 - 0
src/civetweb.c

@@ -14193,6 +14193,11 @@ close_connection(struct mg_connection *conn)
 		conn->ctx->callbacks.connection_close(conn);
 	}
 
+	/* Reset user data, after close callback is called.
+	 * Do not reuse it. If the user needs a destructor,
+	 * it must be done in the connection_close callback. */
+	mg_set_user_connection_data(conn, NULL);
+
 	mg_lock_connection(conn);
 
 	conn->must_close = 1;