aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.c3
-rw-r--r--config.h1
-rw-r--r--websocket.c4
-rw-r--r--websocksy.c1
4 files changed, 7 insertions, 2 deletions
diff --git a/config.c b/config.c
index 6998cc7..c6c8045 100644
--- a/config.c
+++ b/config.c
@@ -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){
diff --git a/config.h b/config.h
index b151486..61e43c1 100644
--- a/config.h
+++ b/config.h
@@ -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,