netutils/websocket: adds websocket status update function
This commit updates missing status change. Websocket server can't
establishes the websocket_handler thread without changing status.
@@ -396,6 +396,8 @@ TLS_HS_RETRY:
return r;
}
+ websocket_update_state(client, WEBSOCKET_RUNNING);
+
if (websocket_make_block(client->fd) != WEBSOCKET_SUCCESS) {
websocket_socket_free(client);
return WEBSOCKET_SOCKET_ERROR;
@@ -856,6 +858,8 @@ websocket_return_t websocket_server_init(websocket_t *server)
return WEBSOCKET_ALLOCATION_ERROR;
}
+ websocket_update_state(server, WEBSOCKET_RUNNING);
+
socket_data = malloc(sizeof(struct websocket_info_t));
if (socket_data == NULL) {
WEBSOCKET_DEBUG("fail to allocate memory\n");
