mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-31 08:07:14 +02:00
code style fix
This commit is contained in:
@ -259,15 +259,13 @@ typedef struct {
|
|||||||
} WSMessageHeader_t;
|
} WSMessageHeader_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
void init(uint8_t num,
|
||||||
void init (uint8_t num,
|
uint32_t pingInterval,
|
||||||
uint32_t pingInterval,
|
uint32_t pongTimeout,
|
||||||
uint32_t pongTimeout,
|
uint8_t disconnectTimeoutCount) {
|
||||||
uint8_t disconnectTimeoutCount)
|
this->num = num;
|
||||||
{
|
this->pingInterval = pingInterval;
|
||||||
this->num = num;
|
this->pongTimeout = pongTimeout;
|
||||||
this->pingInterval = pingInterval;
|
|
||||||
this->pongTimeout = pongTimeout;
|
|
||||||
this->disconnectTimeoutCount = disconnectTimeoutCount;
|
this->disconnectTimeoutCount = disconnectTimeoutCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,19 +282,19 @@ typedef struct {
|
|||||||
WEBSOCKETS_NETWORK_SSL_CLASS * ssl;
|
WEBSOCKETS_NETWORK_SSL_CLASS * ssl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String cUrl; ///< http url
|
String cUrl; ///< http url
|
||||||
uint16_t cCode = 0; ///< http code
|
uint16_t cCode = 0; ///< http code
|
||||||
|
|
||||||
bool cIsClient = false; ///< will be used for masking
|
bool cIsClient = false; ///< will be used for masking
|
||||||
bool cIsUpgrade = false; ///< Connection == Upgrade
|
bool cIsUpgrade = false; ///< Connection == Upgrade
|
||||||
bool cIsWebsocket = false; ///< Upgrade == websocket
|
bool cIsWebsocket = false; ///< Upgrade == websocket
|
||||||
|
|
||||||
String cSessionId; ///< client Set-Cookie (session id)
|
String cSessionId; ///< client Set-Cookie (session id)
|
||||||
String cKey; ///< client Sec-WebSocket-Key
|
String cKey; ///< client Sec-WebSocket-Key
|
||||||
String cAccept; ///< client Sec-WebSocket-Accept
|
String cAccept; ///< client Sec-WebSocket-Accept
|
||||||
String cProtocol; ///< client Sec-WebSocket-Protocol
|
String cProtocol; ///< client Sec-WebSocket-Protocol
|
||||||
String cExtensions; ///< client Sec-WebSocket-Extensions
|
String cExtensions; ///< client Sec-WebSocket-Extensions
|
||||||
uint16_t cVersion = 0; ///< client Sec-WebSocket-Version
|
uint16_t cVersion = 0; ///< client Sec-WebSocket-Version
|
||||||
|
|
||||||
uint8_t cWsRXsize = 0; ///< State of the RX
|
uint8_t cWsRXsize = 0; ///< State of the RX
|
||||||
uint8_t cWsHeader[WEBSOCKETS_MAX_HEADER_SIZE]; ///< RX WS Message buffer
|
uint8_t cWsHeader[WEBSOCKETS_MAX_HEADER_SIZE]; ///< RX WS Message buffer
|
||||||
@ -307,15 +305,15 @@ typedef struct {
|
|||||||
|
|
||||||
String extraHeaders;
|
String extraHeaders;
|
||||||
|
|
||||||
bool cHttpHeadersValid = false; ///< non-websocket http header validity indicator
|
bool cHttpHeadersValid = false; ///< non-websocket http header validity indicator
|
||||||
size_t cMandatoryHeadersCount; ///< non-websocket mandatory http headers present count
|
size_t cMandatoryHeadersCount; ///< non-websocket mandatory http headers present count
|
||||||
|
|
||||||
bool pongReceived = false;
|
bool pongReceived = false;
|
||||||
uint32_t pingInterval = 0; // how often ping will be sent, 0 means "heartbeat is not active"
|
uint32_t pingInterval = 0; // how often ping will be sent, 0 means "heartbeat is not active"
|
||||||
uint32_t lastPing = 0; // millis when last pong has been received
|
uint32_t lastPing = 0; // millis when last pong has been received
|
||||||
uint32_t pongTimeout = 0; // interval in millis after which pong is considered to timeout
|
uint32_t pongTimeout = 0; // interval in millis after which pong is considered to timeout
|
||||||
uint8_t disconnectTimeoutCount = 0; // after how many subsequent pong timeouts discconnect will happen, 0 means "do not disconnect"
|
uint8_t disconnectTimeoutCount = 0; // after how many subsequent pong timeouts discconnect will happen, 0 means "do not disconnect"
|
||||||
uint8_t pongTimeoutCount = 0; // current pong timeout count
|
uint8_t pongTimeoutCount = 0; // current pong timeout count
|
||||||
|
|
||||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
|
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
|
||||||
String cHttpLine; ///< HTTP header lines
|
String cHttpLine; ///< HTTP header lines
|
||||||
|
@ -71,13 +71,12 @@ WebSocketsServer::~WebSocketsServer() {
|
|||||||
* called to initialize the Websocket server
|
* called to initialize the Websocket server
|
||||||
*/
|
*/
|
||||||
void WebSocketsServerCore::begin(void) {
|
void WebSocketsServerCore::begin(void) {
|
||||||
|
|
||||||
// adjust clients storage:
|
// adjust clients storage:
|
||||||
// _clients[i]'s constructor are already called,
|
// _clients[i]'s constructor are already called,
|
||||||
// all its members are initialized to their default value,
|
// all its members are initialized to their default value,
|
||||||
// except the ones explicitly detailed in WSclient_t() constructor.
|
// except the ones explicitly detailed in WSclient_t() constructor.
|
||||||
// Then we need to initialize some members to non-trivial values:
|
// Then we need to initialize some members to non-trivial values:
|
||||||
for (int i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
|
for(int i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
|
||||||
_clients[i].init(i, _pingInterval, _pongTimeout, _disconnectTimeoutCount);
|
_clients[i].init(i, _pingInterval, _pongTimeout, _disconnectTimeoutCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +99,7 @@ void WebSocketsServerCore::close(void) {
|
|||||||
|
|
||||||
// restore _clients[] to their initial state
|
// restore _clients[] to their initial state
|
||||||
// before next call to ::begin()
|
// before next call to ::begin()
|
||||||
for (int i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
|
for(int i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
|
||||||
_clients[i] = WSclient_t();
|
_clients[i] = WSclient_t();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user