Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bd011d8

Browse files
committedSep 6, 2024
clang
1 parent af17970 commit bd011d8

File tree

5 files changed

+37
-38
lines changed

5 files changed

+37
-38
lines changed
 

‎src/SocketIOclient.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ class SocketIOclient : protected WebSocketsClient {
5656
#ifndef SSL_AXTLS
5757
void beginSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", const char * CA_cert = NULL, const char * protocol = "arduino", uint32_t pingInterval = 60 * 1000, uint32_t pongTimeout = 90 * 1000, uint8_t disconnectTimeoutCount = 5);
5858
void setSSLClientCertKey(const char * clientCert = NULL, const char * clientPrivateKey = NULL);
59-
#if defined(SSL_BARESSL)
59+
#if defined(SSL_BARESSL)
6060
void beginSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino", uint32_t pingInterval = 60 * 1000, uint32_t pongTimeout = 90 * 1000, uint8_t disconnectTimeoutCount = 5);
6161
void setSSLClientCertKey(BearSSL::X509List * clientCert = NULL, BearSSL::PrivateKey * clientPrivateKey = NULL);
62-
#endif
62+
#endif
6363
#endif
6464
#endif
6565
bool isConnected(void);

‎src/WebSockets.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@
262262

263263
#elif(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA)
264264
#if __has_include(<WiFiNINA.h>)
265-
#include <WiFiNINA.h>
265+
#include <WiFiNINA.h>
266266
#else
267-
#error "Please install WiFiNINA library!"
267+
#error "Please install WiFiNINA library!"
268268
#endif
269269

270270
#define WEBSOCKETS_NETWORK_CLASS WiFiClient
@@ -273,10 +273,10 @@
273273

274274
#elif(WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED)
275275
#if __has_include(<rpcWiFi.h>) && __has_include(<rpcWiFiClientSecure.h>)
276-
#include <rpcWiFi.h>
277-
#include <rpcWiFiClientSecure.h>
276+
#include <rpcWiFi.h>
277+
#include <rpcWiFiClientSecure.h>
278278
#else
279-
#error "Please install rpcWiFi library!"
279+
#error "Please install rpcWiFi library!"
280280
#endif
281281

282282
#define WEBSOCKETS_NETWORK_CLASS WiFiClient

‎src/WebSocketsClient.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ void WebSocketsClient::setSSLClientCertKey(BearSSL::X509List * clientCert, BearS
177177
}
178178
#endif // SSL_BARESSL
179179

180-
181180
#endif // SSL_AXTLS
182181
#endif // HAS_SSL
183182

@@ -245,12 +244,12 @@ void WebSocketsClient::loop(void) {
245244
if(_client.isSSL) {
246245
DEBUG_WEBSOCKETS("[WS-Client] connect wss...\n");
247246
if(_client.ssl) {
248-
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4)
249-
// does not support delete (no destructor)
250-
#else
251-
delete _client.ssl;
252-
#endif
253-
247+
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
248+
// does not support delete (no destructor)
249+
#else
250+
delete _client.ssl;
251+
#endif
252+
254253
_client.ssl = NULL;
255254
_client.tcp = NULL;
256255
}
@@ -295,11 +294,11 @@ void WebSocketsClient::loop(void) {
295294
} else {
296295
DEBUG_WEBSOCKETS("[WS-Client] connect ws...\n");
297296
if(_client.tcp) {
298-
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4)
299-
// does not support delete (no destructor)
300-
#else
297+
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
298+
// does not support delete (no destructor)
299+
#else
301300
delete _client.tcp;
302-
#endif
301+
#endif
303302
_client.tcp = NULL;
304303
}
305304
_client.tcp = new WEBSOCKETS_NETWORK_CLASS();
@@ -550,11 +549,11 @@ void WebSocketsClient::clientDisconnect(WSclient_t * client) {
550549
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
551550
client->status = WSC_NOT_CONNECTED;
552551
#else
553-
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4)
554-
// does not support delete (no destructor)
555-
#else
556-
delete client->tcp;
557-
#endif
552+
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
553+
// does not support delete (no destructor)
554+
#else
555+
delete client->tcp;
556+
#endif
558557
#endif
559558
client->tcp = NULL;
560559
}

‎src/WebSocketsClient.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ class WebSocketsClient : protected WebSockets {
4848
void beginSSL(String host, uint16_t port, String url = "/", String fingerprint = "", String protocol = "arduino");
4949
#else
5050
void beginSSL(const char * host, uint16_t port, const char * url = "/", const uint8_t * fingerprint = NULL, const char * protocol = "arduino");
51-
#if defined(SSL_BARESSL)
51+
#if defined(SSL_BARESSL)
5252
void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino");
5353
void setSSLClientCertKey(BearSSL::X509List * clientCert = NULL, BearSSL::PrivateKey * clientPrivateKey = NULL);
54-
#endif
54+
#endif
5555
void setSSLClientCertKey(const char * clientCert = NULL, const char * clientPrivateKey = NULL);
5656
#endif
5757
void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", const char * CA_cert = NULL, const char * protocol = "arduino");
@@ -131,11 +131,11 @@ class WebSocketsClient : protected WebSockets {
131131
#define SSL_FINGERPRINT_NULL ""
132132
#else
133133
const uint8_t * _fingerprint;
134-
#if defined(SSL_BARESSL)
134+
#if defined(SSL_BARESSL)
135135
BearSSL::X509List * _CA_cert;
136136
BearSSL::X509List * _client_cert;
137137
BearSSL::PrivateKey * _client_key;
138-
#endif
138+
#endif
139139
#define SSL_FINGERPRINT_IS_SET (_fingerprint != NULL)
140140
#define SSL_FINGERPRINT_NULL NULL
141141
#endif

‎src/WebSocketsServer.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ WebSocketsServerCore::~WebSocketsServerCore() {
6565
}
6666

6767
WebSocketsServer::~WebSocketsServer() {
68-
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED)
69-
// does not support delete (no destructor)
70-
#else
71-
delete _server;
72-
#endif
68+
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED)
69+
// does not support delete (no destructor)
70+
#else
71+
delete _server;
72+
#endif
7373
}
7474

7575
/**
@@ -660,12 +660,12 @@ void WebSocketsServer::handleNewClients(void) {
660660
while(_server->hasClient()) {
661661
#endif
662662

663-
// store new connection
664-
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA)
665-
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->available());
666-
#else
667-
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->accept());
668-
#endif
663+
// store new connection
664+
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA)
665+
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->available());
666+
#else
667+
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->accept());
668+
#endif
669669

670670
if(!tcpClient) {
671671
DEBUG_WEBSOCKETS("[WS-Client] creating Network class failed!");

0 commit comments

Comments
 (0)
Please sign in to comment.