Skip to content

Commit

Permalink
clang
Browse files Browse the repository at this point in the history
  • Loading branch information
Links2004 committed Sep 6, 2024
1 parent af17970 commit bd011d8
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/SocketIOclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class SocketIOclient : protected WebSocketsClient {
#ifndef SSL_AXTLS
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);
void setSSLClientCertKey(const char * clientCert = NULL, const char * clientPrivateKey = NULL);
#if defined(SSL_BARESSL)
#if defined(SSL_BARESSL)
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);
void setSSLClientCertKey(BearSSL::X509List * clientCert = NULL, BearSSL::PrivateKey * clientPrivateKey = NULL);
#endif
#endif
#endif
#endif
bool isConnected(void);
Expand Down
10 changes: 5 additions & 5 deletions src/WebSockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@

#elif(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA)
#if __has_include(<WiFiNINA.h>)
#include <WiFiNINA.h>
#include <WiFiNINA.h>
#else
#error "Please install WiFiNINA library!"
#error "Please install WiFiNINA library!"
#endif

#define WEBSOCKETS_NETWORK_CLASS WiFiClient
Expand All @@ -273,10 +273,10 @@

#elif(WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED)
#if __has_include(<rpcWiFi.h>) && __has_include(<rpcWiFiClientSecure.h>)
#include <rpcWiFi.h>
#include <rpcWiFiClientSecure.h>
#include <rpcWiFi.h>
#include <rpcWiFiClientSecure.h>
#else
#error "Please install rpcWiFi library!"
#error "Please install rpcWiFi library!"
#endif

#define WEBSOCKETS_NETWORK_CLASS WiFiClient
Expand Down
31 changes: 15 additions & 16 deletions src/WebSocketsClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ void WebSocketsClient::setSSLClientCertKey(BearSSL::X509List * clientCert, BearS
}
#endif // SSL_BARESSL


#endif // SSL_AXTLS
#endif // HAS_SSL

Expand Down Expand Up @@ -245,12 +244,12 @@ void WebSocketsClient::loop(void) {
if(_client.isSSL) {
DEBUG_WEBSOCKETS("[WS-Client] connect wss...\n");
if(_client.ssl) {
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4)
// does not support delete (no destructor)
#else
delete _client.ssl;
#endif
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
// does not support delete (no destructor)
#else
delete _client.ssl;
#endif

_client.ssl = NULL;
_client.tcp = NULL;
}
Expand Down Expand Up @@ -295,11 +294,11 @@ void WebSocketsClient::loop(void) {
} else {
DEBUG_WEBSOCKETS("[WS-Client] connect ws...\n");
if(_client.tcp) {
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4)
// does not support delete (no destructor)
#else
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
// does not support delete (no destructor)
#else
delete _client.tcp;
#endif
#endif
_client.tcp = NULL;
}
_client.tcp = new WEBSOCKETS_NETWORK_CLASS();
Expand Down Expand Up @@ -550,11 +549,11 @@ void WebSocketsClient::clientDisconnect(WSclient_t * client) {
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
client->status = WSC_NOT_CONNECTED;
#else
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4)
// does not support delete (no destructor)
#else
delete client->tcp;
#endif
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
// does not support delete (no destructor)
#else
delete client->tcp;
#endif
#endif
client->tcp = NULL;
}
Expand Down
8 changes: 4 additions & 4 deletions src/WebSocketsClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ class WebSocketsClient : protected WebSockets {
void beginSSL(String host, uint16_t port, String url = "/", String fingerprint = "", String protocol = "arduino");
#else
void beginSSL(const char * host, uint16_t port, const char * url = "/", const uint8_t * fingerprint = NULL, const char * protocol = "arduino");
#if defined(SSL_BARESSL)
#if defined(SSL_BARESSL)
void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino");
void setSSLClientCertKey(BearSSL::X509List * clientCert = NULL, BearSSL::PrivateKey * clientPrivateKey = NULL);
#endif
#endif
void setSSLClientCertKey(const char * clientCert = NULL, const char * clientPrivateKey = NULL);
#endif
void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", const char * CA_cert = NULL, const char * protocol = "arduino");
Expand Down Expand Up @@ -131,11 +131,11 @@ class WebSocketsClient : protected WebSockets {
#define SSL_FINGERPRINT_NULL ""
#else
const uint8_t * _fingerprint;
#if defined(SSL_BARESSL)
#if defined(SSL_BARESSL)
BearSSL::X509List * _CA_cert;
BearSSL::X509List * _client_cert;
BearSSL::PrivateKey * _client_key;
#endif
#endif
#define SSL_FINGERPRINT_IS_SET (_fingerprint != NULL)
#define SSL_FINGERPRINT_NULL NULL
#endif
Expand Down
22 changes: 11 additions & 11 deletions src/WebSocketsServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ WebSocketsServerCore::~WebSocketsServerCore() {
}

WebSocketsServer::~WebSocketsServer() {
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED)
// does not support delete (no destructor)
#else
delete _server;
#endif
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED)
// does not support delete (no destructor)
#else
delete _server;
#endif
}

/**
Expand Down Expand Up @@ -660,12 +660,12 @@ void WebSocketsServer::handleNewClients(void) {
while(_server->hasClient()) {
#endif

// store new connection
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA)
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->available());
#else
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->accept());
#endif
// store new connection
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA)
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->available());
#else
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->accept());
#endif

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

0 comments on commit bd011d8

Please sign in to comment.