]> jfr.im git - solanum.git/blobdiff - wsockd/wsockd.c
switch "KDX-Line active for" snote to L_NETWIDE and include which mask
[solanum.git] / wsockd / wsockd.c
index ec9de8c01ec9bef3274370cb7270a588be39cb0b..82f2f89ff0cd3078688980e196cd0b8666b0f324 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  wsockd.c: charybdis websockets helper
+ *  wsockd.c: solanum websockets helper
  *  Copyright (C) 2007 Aaron Sethman <androsyn@ratbox.org>
  *  Copyright (C) 2007 ircd-ratbox development team
  *  Copyright (C) 2016 William Pitcock <nenolod@dereferenced.org>
@@ -106,6 +106,8 @@ typedef struct {
        uint8_t payload_length_mask; // payload_length: 7, mask: 1
 } ws_frame_hdr_t;
 
+#define WEBSOCKET_FRAME_HDR_INIT ((ws_frame_hdr_t) { 0, 0 })
+
 typedef struct {
        ws_frame_hdr_t header;
        uint8_t payload_data[WEBSOCKET_MAX_UNEXTENDED_PAYLOAD_DATA_LENGTH];
@@ -120,6 +122,8 @@ typedef struct {
        uint16_t payload_length_extended;
 } ws_frame_ext_t;
 
+#define WEBSOCKET_FRAME_EXT_INIT ((ws_frame_ext_t) { WEBSOCKET_FRAME_HDR_INIT, 0 })
+
 typedef struct {
        ws_frame_hdr_t header;
        uint64_t payload_length_extended;
@@ -327,7 +331,7 @@ conn_mod_write(conn_t * conn, void *data, size_t len)
 static void
 conn_mod_write_short_frame(conn_t * conn, void *data, int len)
 {
-       ws_frame_hdr_t hdr;
+       ws_frame_hdr_t hdr = WEBSOCKET_FRAME_HDR_INIT;
 
        ws_frame_set_opcode(&hdr, WEBSOCKET_OPCODE_TEXT_FRAME);
        ws_frame_set_fin(&hdr, 1);
@@ -341,7 +345,7 @@ conn_mod_write_short_frame(conn_t * conn, void *data, int len)
 static void
 conn_mod_write_long_frame(conn_t * conn, void *data, int len)
 {
-       ws_frame_ext_t hdr;
+       ws_frame_ext_t hdr = WEBSOCKET_FRAME_EXT_INIT;
 
        ws_frame_set_opcode(&hdr.header, WEBSOCKET_OPCODE_TEXT_FRAME);
        ws_frame_set_fin(&hdr.header, 1);
@@ -947,7 +951,7 @@ int
 main(int argc, char **argv)
 {
        const char *s_ctlfd, *s_pipe, *s_pid;
-       int ctlfd, pipefd, x, maxfd;
+       int ctlfd, pipefd, maxfd;
        maxfd = maxconn();
 
        s_ctlfd = getenv("CTL_FD");
@@ -957,7 +961,7 @@ main(int argc, char **argv)
        if(s_ctlfd == NULL || s_pipe == NULL || s_pid == NULL)
        {
                fprintf(stderr,
-                       "This is the charybdis wsockd for internal ircd use.\n");
+                       "This is the solanum wsockd for internal ircd use.\n");
                fprintf(stderr,
                        "You aren't supposed to run me directly. Exiting.\n");
                exit(1);
@@ -966,8 +970,9 @@ main(int argc, char **argv)
        ctlfd = atoi(s_ctlfd);
        pipefd = atoi(s_pipe);
        ppid = atoi(s_pid);
-       x = 0;
+
 #ifndef _WIN32
+       int x = 0;
        for(x = 0; x < maxfd; x++)
        {
                if(x != ctlfd && x != pipefd && x > 2)