fix code style

This commit is contained in:
Links
2022-04-05 19:10:57 +02:00
parent 8d76469e90
commit ab9af162b2
5 changed files with 48 additions and 48 deletions

View File

@ -42,13 +42,13 @@ extern "C" {
#include <esp_system.h> #include <esp_system.h>
#if ESP_IDF_VERSION_MAJOR >= 4 #if ESP_IDF_VERSION_MAJOR >= 4
#if ( ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(1, 0, 6) ) #if(ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(1, 0, 6))
#include "sha/sha_parallel_engine.h" #include "sha/sha_parallel_engine.h"
#else
#include <esp32/sha.h>
#endif
#else #else
#include <hwcrypto/sha.h> #include <esp32/sha.h>
#endif
#else
#include <hwcrypto/sha.h>
#endif #endif
#else #else
@ -472,7 +472,7 @@ void WebSockets::handleWebsocketPayloadCb(WSclient_t * client, bool ok, uint8_t
payload[header->payloadLen] = 0x00; payload[header->payloadLen] = 0x00;
if(header->mask) { if(header->mask) {
//decode XOR // decode XOR
for(size_t i = 0; i < header->payloadLen; i++) { for(size_t i = 0; i < header->payloadLen; i++) {
payload[i] = (payload[i] ^ header->maskKey[i % 4]); payload[i] = (payload[i] ^ header->maskKey[i % 4]);
} }
@ -526,7 +526,7 @@ void WebSockets::handleWebsocketPayloadCb(WSclient_t * client, bool ok, uint8_t
// reset input // reset input
client->cWsRXsize = 0; client->cWsRXsize = 0;
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC) #if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
//register callback for next message // register callback for next message
handleWebsocketWaitFor(client, 2); handleWebsocketWaitFor(client, 2);
#endif #endif
@ -644,9 +644,9 @@ bool WebSockets::readCb(WSclient_t * client, uint8_t * out, size_t n, WSreadWait
t = millis(); t = millis();
out += len; out += len;
n -= len; n -= len;
//DEBUG_WEBSOCKETS("Receive %d left %d!\n", len, n); // DEBUG_WEBSOCKETS("Receive %d left %d!\n", len, n);
} else { } else {
//DEBUG_WEBSOCKETS("Receive %d left %d!\n", len, n); // DEBUG_WEBSOCKETS("Receive %d left %d!\n", len, n);
} }
if(n > 0) { if(n > 0) {
WEBSOCKETS_YIELD(); WEBSOCKETS_YIELD();
@ -698,7 +698,7 @@ size_t WebSockets::write(WSclient_t * client, uint8_t * out, size_t n) {
out += len; out += len;
n -= len; n -= len;
total += len; total += len;
//DEBUG_WEBSOCKETS("write %d left %d!\n", len, n); // DEBUG_WEBSOCKETS("write %d left %d!\n", len, n);
} else { } else {
DEBUG_WEBSOCKETS("WS write %d failed left %d!\n", len, n); DEBUG_WEBSOCKETS("WS write %d failed left %d!\n", len, n);
} }

View File

@ -86,7 +86,7 @@
#define WEBSOCKETS_YIELD_MORE() #define WEBSOCKETS_YIELD_MORE()
#else #else
//atmega328p has only 2KB ram! // atmega328p has only 2KB ram!
#define WEBSOCKETS_MAX_DATA_SIZE (1024) #define WEBSOCKETS_MAX_DATA_SIZE (1024)
// moves all Header strings to Flash // moves all Header strings to Flash
#define WEBSOCKETS_SAVE_RAM #define WEBSOCKETS_SAVE_RAM

View File

@ -621,7 +621,7 @@ WSclient_t * WebSocketsServerCore::handleNewClient(WEBSOCKETS_NETWORK_CLASS * tc
#endif #endif
// no client! => create dummy! // no client! => create dummy!
WSclient_t dummy = WSclient_t(); WSclient_t dummy = WSclient_t();
client = & dummy; client = &dummy;
client->tcp = tcpClient; client->tcp = tcpClient;
dropNativeClient(client); dropNativeClient(client);
} }
@ -663,7 +663,7 @@ void WebSocketsServerCore::handleClientData(void) {
if(clientIsConnected(client)) { if(clientIsConnected(client)) {
int len = client->tcp->available(); int len = client->tcp->available();
if(len > 0) { if(len > 0) {
//DEBUG_WEBSOCKETS("[WS-Server][%d][handleClientData] len: %d\n", client->num, len); // DEBUG_WEBSOCKETS("[WS-Server][%d][handleClientData] len: %d\n", client->num, len);
switch(client->status) { switch(client->status) {
case WSC_HEADER: { case WSC_HEADER: {
String headerLine = client->tcp->readStringUntil('\n'); String headerLine = client->tcp->readStringUntil('\n');
@ -717,7 +717,7 @@ void WebSocketsServerCore::handleHeader(WSclient_t * client, String * headerLine
// cut URL out // cut URL out
client->cUrl = headerLine->substring(4, headerLine->indexOf(' ', 4)); client->cUrl = headerLine->substring(4, headerLine->indexOf(' ', 4));
//reset non-websocket http header validation state for this client // reset non-websocket http header validation state for this client
client->cHttpHeadersValid = true; client->cHttpHeadersValid = true;
client->cMandatoryHeadersCount = 0; client->cMandatoryHeadersCount = 0;

View File

@ -192,10 +192,10 @@ class WebSocketsServerCore : protected WebSockets {
*/ */
virtual bool execHttpHeaderValidation(String headerName, String headerValue) { virtual bool execHttpHeaderValidation(String headerName, String headerValue) {
if(_httpHeaderValidationFunc) { if(_httpHeaderValidationFunc) {
//return the value of the custom http header validation function // return the value of the custom http header validation function
return _httpHeaderValidationFunc(headerName, headerValue); return _httpHeaderValidationFunc(headerName, headerValue);
} }
//no custom http header validation so just assume all is good // no custom http header validation so just assume all is good
return true; return true;
} }