diff options
author | cbdev <cb@cbcdn.com> | 2024-02-27 22:56:19 +0100 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2024-02-27 22:56:19 +0100 |
commit | c4d1da757fc32e8d05e592f3b60484e2bfbf8d67 (patch) | |
tree | 399ae1be7b850e43268a3175ad883e94c2cd3dee | |
parent | d80b85d2b61225a27fa7b2058f60831d4a73110f (diff) | |
download | websocksy-master.tar.gz websocksy-master.tar.bz2 websocksy-master.zip |
-rw-r--r-- | config.c | 3 | ||||
-rw-r--r-- | config.h | 1 | ||||
-rw-r--r-- | websocket.c | 4 | ||||
-rw-r--r-- | websocksy.c | 1 |
4 files changed, 7 insertions, 2 deletions
@@ -25,6 +25,9 @@ static int config_file_line(ws_config* config, char* key, char* value, size_t li else if(!strcmp(key, "ping")){ config->ping_interval = strtoul(value, NULL, 10); } + else if(!strcmp(key, "verbosity")){ + config->verbosity = strtoul(value, NULL, 10); + } else if(!strcmp(key, "backend")){ //clean up the previously registered backend if(config->backend.cleanup){ @@ -2,6 +2,7 @@ typedef struct /*_websocksy_config*/ { char* host; char* port; + unsigned verbosity; time_t ping_interval; ws_backend backend; } ws_config; diff --git a/websocket.c b/websocket.c index f3c2631..b720aca 100644 --- a/websocket.c +++ b/websocket.c @@ -383,7 +383,7 @@ static size_t ws_frame(websocket* ws){ case ws_frame_binary: //forward to peer if(ws->peer_fd >= 0){ - fprintf(stderr, "WS -> Peer %lu bytes\n", payload_length); + //fprintf(stderr, "WS -> Peer %lu bytes\n", payload_length); if(network_send(ws->peer_fd, payload, payload_length)){ ws_close(ws, ws_close_unexpected, "Failed to forward"); } @@ -412,7 +412,7 @@ static size_t ws_frame(websocket* ws){ /* Construct and send a WebSocket frame */ int ws_send_frame(websocket* ws, ws_operation opcode, uint8_t* data, size_t len){ - fprintf(stderr, "Peer -> WS %lu bytes (%02X)\n", len, opcode); + //fprintf(stderr, "Peer -> WS %lu bytes (%02X)\n", len, opcode); uint8_t frame_header[WS_FRAME_HEADER_LEN]; size_t header_bytes = 2; uint16_t* payload_len16 = (uint16_t*) (frame_header + 2); diff --git a/websocksy.c b/websocksy.c index b6310ce..25cc743 100644 --- a/websocksy.c +++ b/websocksy.c @@ -47,6 +47,7 @@ static ws_config config = { .host = NULL, .port = NULL, .ping_interval = 30, + .verbosity = 0, /* Assign the built-in defaultpeer backend by default */ .backend.init = backend_defaultpeer_init, .backend.config = backend_defaultpeer_configure, |