Skip to content

Commit 822618f

Browse files
committed
code style fix
1 parent 1b4f186 commit 822618f

File tree

2 files changed

+28
-31
lines changed

2 files changed

+28
-31
lines changed

src/WebSockets.h

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,13 @@ typedef struct {
259259
} WSMessageHeader_t;
260260

261261
typedef struct {
262-
263-
void init (uint8_t num,
264-
uint32_t pingInterval,
265-
uint32_t pongTimeout,
266-
uint8_t disconnectTimeoutCount)
267-
{
268-
this->num = num;
269-
this->pingInterval = pingInterval;
270-
this->pongTimeout = pongTimeout;
262+
void init(uint8_t num,
263+
uint32_t pingInterval,
264+
uint32_t pongTimeout,
265+
uint8_t disconnectTimeoutCount) {
266+
this->num = num;
267+
this->pingInterval = pingInterval;
268+
this->pongTimeout = pongTimeout;
271269
this->disconnectTimeoutCount = disconnectTimeoutCount;
272270
}
273271

@@ -284,19 +282,19 @@ typedef struct {
284282
WEBSOCKETS_NETWORK_SSL_CLASS * ssl;
285283
#endif
286284

287-
String cUrl; ///< http url
288-
uint16_t cCode = 0; ///< http code
285+
String cUrl; ///< http url
286+
uint16_t cCode = 0; ///< http code
289287

290-
bool cIsClient = false; ///< will be used for masking
291-
bool cIsUpgrade = false; ///< Connection == Upgrade
292-
bool cIsWebsocket = false; ///< Upgrade == websocket
288+
bool cIsClient = false; ///< will be used for masking
289+
bool cIsUpgrade = false; ///< Connection == Upgrade
290+
bool cIsWebsocket = false; ///< Upgrade == websocket
293291

294-
String cSessionId; ///< client Set-Cookie (session id)
295-
String cKey; ///< client Sec-WebSocket-Key
296-
String cAccept; ///< client Sec-WebSocket-Accept
297-
String cProtocol; ///< client Sec-WebSocket-Protocol
298-
String cExtensions; ///< client Sec-WebSocket-Extensions
299-
uint16_t cVersion = 0; ///< client Sec-WebSocket-Version
292+
String cSessionId; ///< client Set-Cookie (session id)
293+
String cKey; ///< client Sec-WebSocket-Key
294+
String cAccept; ///< client Sec-WebSocket-Accept
295+
String cProtocol; ///< client Sec-WebSocket-Protocol
296+
String cExtensions; ///< client Sec-WebSocket-Extensions
297+
uint16_t cVersion = 0; ///< client Sec-WebSocket-Version
300298

301299
uint8_t cWsRXsize = 0; ///< State of the RX
302300
uint8_t cWsHeader[WEBSOCKETS_MAX_HEADER_SIZE]; ///< RX WS Message buffer
@@ -307,15 +305,15 @@ typedef struct {
307305

308306
String extraHeaders;
309307

310-
bool cHttpHeadersValid = false; ///< non-websocket http header validity indicator
311-
size_t cMandatoryHeadersCount; ///< non-websocket mandatory http headers present count
308+
bool cHttpHeadersValid = false; ///< non-websocket http header validity indicator
309+
size_t cMandatoryHeadersCount; ///< non-websocket mandatory http headers present count
312310

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
311+
bool pongReceived = false;
312+
uint32_t pingInterval = 0; // how often ping will be sent, 0 means "heartbeat is not active"
313+
uint32_t lastPing = 0; // millis when last pong has been received
314+
uint32_t pongTimeout = 0; // interval in millis after which pong is considered to timeout
315+
uint8_t disconnectTimeoutCount = 0; // after how many subsequent pong timeouts discconnect will happen, 0 means "do not disconnect"
316+
uint8_t pongTimeoutCount = 0; // current pong timeout count
319317

320318
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
321319
String cHttpLine; ///< HTTP header lines

src/WebSocketsServer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,12 @@ WebSocketsServer::~WebSocketsServer() {
7171
* called to initialize the Websocket server
7272
*/
7373
void WebSocketsServerCore::begin(void) {
74-
7574
// adjust clients storage:
7675
// _clients[i]'s constructor are already called,
7776
// all its members are initialized to their default value,
7877
// except the ones explicitly detailed in WSclient_t() constructor.
7978
// Then we need to initialize some members to non-trivial values:
80-
for (int i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
79+
for(int i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
8180
_clients[i].init(i, _pingInterval, _pongTimeout, _disconnectTimeoutCount);
8281
}
8382

@@ -100,7 +99,7 @@ void WebSocketsServerCore::close(void) {
10099

101100
// restore _clients[] to their initial state
102101
// before next call to ::begin()
103-
for (int i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
102+
for(int i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
104103
_clients[i] = WSclient_t();
105104
}
106105
}

0 commit comments

Comments
 (0)