summaryrefslogtreecommitdiffstats
path: root/src/web.c
diff options
context:
space:
mode:
authorgrm <grm@eyesin.space>2025-02-22 03:40:43 +0200
committergrm <grm@eyesin.space>2025-02-22 03:40:43 +0200
commit35208c579c9e7d0078d786e61f4a323919e2dcdf (patch)
tree022f464e6350c18f76443a6e96eccd02698df7d1 /src/web.c
parent500b9a07b93d6cd3e771edc5698e06d163da60f1 (diff)
downloadsynth-project-35208c579c9e7d0078d786e61f4a323919e2dcdf.tar.gz
synth-project-35208c579c9e7d0078d786e61f4a323919e2dcdf.tar.bz2
synth-project-35208c579c9e7d0078d786e61f4a323919e2dcdf.zip
Small fixesHEADmaster
Diffstat (limited to 'src/web.c')
-rw-r--r--src/web.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/web.c b/src/web.c
index e23d8b2..3a65850 100644
--- a/src/web.c
+++ b/src/web.c
@@ -104,6 +104,10 @@ enum MHD_Result handle_request(void *cls, struct MHD_Connection *connection,
const char *url, const char *method,
const char *version, const char *upload_data,
size_t *upload_data_size, void **con_cls) {
+ (void)version;
+ (void)upload_data;
+ (void)upload_data_size;
+ (void)con_cls;
struct MHD_Response *response;
enum MHD_Result ret;
@@ -126,7 +130,7 @@ enum MHD_Result handle_request(void *cls, struct MHD_Connection *connection,
MHD_destroy_response(response);
return ret;
}
-
+
response = MHD_create_response_from_buffer(strlen(html_content), (void *)html_content, MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
MHD_destroy_response(response);
@@ -136,6 +140,7 @@ enum MHD_Result handle_request(void *cls, struct MHD_Connection *connection,
// Callback to handle WebSocket events
static int callback_ws(struct lws *wsi, enum lws_callback_reasons reason,
void *user, void *in, size_t len) {
+ (void)user;
char buf[10000] = "";
char tmp[10000] = "";
switch (reason) {
@@ -175,10 +180,10 @@ static int callback_ws(struct lws *wsi, enum lws_callback_reasons reason,
lws_write(wsi, (unsigned char *)buf, strlen(buf), LWS_WRITE_HTTP);
return -1;
break;
- }
+ }
case LWS_CALLBACK_CLOSED: {
printf("WebSocket connection closed with client: %p\n", wsi);
- }
+ }
default:
break;
}
@@ -187,12 +192,13 @@ static int callback_ws(struct lws *wsi, enum lws_callback_reasons reason,
// Thread function to run the WebSocket server
void *websocket_server_thread(void *arg) {
+ (void)arg;
struct lws_context_creation_info info;
struct lws_context *context;
struct lws_protocols protocols[] = {
//{ "http-only", callback_http, 0, 0 },
- { "ws", callback_ws, 0, 128 },
- { NULL, NULL, 0, 0 } // Terminator
+ { "ws", callback_ws, 0, 128, 0, 0, 0 },
+ { NULL, NULL, 0, 0, 0, 0, 0 } // Terminator
};
memset(&info, 0, sizeof(info));
@@ -251,7 +257,7 @@ void ws_send_message(const char *message) {
memcpy(&buffer[LWS_PRE], message, msg_len);
lws_write(client_wsi, &buffer[LWS_PRE], msg_len, LWS_WRITE_TEXT);
printf("[WS]: Sent <<%s>>\n", message);
-
+
//lws_write(client_wsi, (unsigned char *)message, strlen(message), LWS_WRITE_TEXT);
}
}