浏览代码

WS client: Pass user_data also as callback argument

Currently the user_data argument supplied to mg_connect_websocket_client
is stored in the context only, and accessible using mg_get_context and
mg_get_user_data. It should also be passed directly to the data_func
and close_func callbacks.

See #409
bel 8 年之前
父节点
当前提交
6c6316124d
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/civetweb.c

+ 1 - 1
src/civetweb.c

@@ -13711,7 +13711,7 @@ mg_connect_websocket_client(const char *host,
 	thread_data->conn = conn;
 	thread_data->data_handler = data_func;
 	thread_data->close_handler = close_func;
-	thread_data->callback_data = NULL;
+	thread_data->callback_data = user_data;
 
 	/* Start a thread to read the websocket client connection
 	 * This thread will automatically stop when mg_disconnect is