@@ -258,11 +258,7 @@ typedef struct {
258258 uint8_t * maskKey;
259259} WSMessageHeader_t;
260260
261- struct WSclient_t {
262-
263- WSclient_t (): status(WSC_NOT_CONNECTED)
264- {
265- }
261+ typedef struct {
266262
267263 void init (uint8_t num,
268264 uint32_t pingInterval,
@@ -275,34 +271,34 @@ struct WSclient_t {
275271 this ->disconnectTimeoutCount = disconnectTimeoutCount;
276272 }
277273
278- uint8_t num; // /< connection number
274+ uint8_t num = 0 ; // /< connection number
279275
280- WSclientsStatus_t status;
276+ WSclientsStatus_t status = WSC_NOT_CONNECTED ;
281277
282- WEBSOCKETS_NETWORK_CLASS * tcp;
278+ WEBSOCKETS_NETWORK_CLASS * tcp = nullptr ;
283279
284- bool isSocketIO; // /< client for socket.io server
280+ bool isSocketIO = false ; // /< client for socket.io server
285281
286282#if defined(HAS_SSL)
287- bool isSSL; // /< run in ssl mode
283+ bool isSSL = false ; // /< run in ssl mode
288284 WEBSOCKETS_NETWORK_SSL_CLASS * ssl;
289285#endif
290286
291- String cUrl; // /< http url
292- uint16_t cCode; // /< http code
287+ String cUrl; // /< http url
288+ uint16_t cCode = 0 ; // /< http code
293289
294290 bool cIsClient = false ; // /< will be used for masking
295- bool cIsUpgrade; // /< Connection == Upgrade
296- bool cIsWebsocket; // /< Upgrade == websocket
291+ bool cIsUpgrade = false ; // /< Connection == Upgrade
292+ bool cIsWebsocket = false ; // /< Upgrade == websocket
297293
298294 String cSessionId; // /< client Set-Cookie (session id)
299295 String cKey; // /< client Sec-WebSocket-Key
300296 String cAccept; // /< client Sec-WebSocket-Accept
301297 String cProtocol; // /< client Sec-WebSocket-Protocol
302298 String cExtensions; // /< client Sec-WebSocket-Extensions
303- uint16_t cVersion; // /< client Sec-WebSocket-Version
299+ uint16_t cVersion = 0 ; // /< client Sec-WebSocket-Version
304300
305- uint8_t cWsRXsize; // /< State of the RX
301+ uint8_t cWsRXsize = 0 ; // /< State of the RX
306302 uint8_t cWsHeader[WEBSOCKETS_MAX_HEADER_SIZE]; // /< RX WS Message buffer
307303 WSMessageHeader_t cWsHeaderDecode;
308304
@@ -311,21 +307,21 @@ struct WSclient_t {
311307
312308 String extraHeaders;
313309
314- bool cHttpHeadersValid; // /< non-websocket http header validity indicator
310+ bool cHttpHeadersValid = false ; // /< non-websocket http header validity indicator
315311 size_t cMandatoryHeadersCount; // /< non-websocket mandatory http headers present count
316312
317- bool pongReceived;
318- uint32_t pingInterval; // how often ping will be sent, 0 means "heartbeat is not active"
319- uint32_t lastPing; // millis when last pong has been received
320- uint32_t pongTimeout; // interval in millis after which pong is considered to timeout
321- uint8_t disconnectTimeoutCount; // after how many subsequent pong timeouts discconnect will happen, 0 means "do not disconnect"
322- uint8_t pongTimeoutCount; // current pong timeout count
313+ bool pongReceived = false ;
314+ uint32_t pingInterval = 0 ; // how often ping will be sent, 0 means "heartbeat is not active"
315+ uint32_t lastPing = 0 ; // millis when last pong has been received
316+ uint32_t pongTimeout = 0 ; // interval in millis after which pong is considered to timeout
317+ uint8_t disconnectTimeoutCount = 0 ; // after how many subsequent pong timeouts discconnect will happen, 0 means "do not disconnect"
318+ uint8_t pongTimeoutCount = 0 ; // current pong timeout count
323319
324320#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
325321 String cHttpLine; // /< HTTP header lines
326322#endif
327323
328- };
324+ } WSclient_t ;
329325
330326class WebSockets {
331327 protected:
0 commit comments