8000 code style · AlphaHolding/arduinoWebSockets@28cd929 · GitHub
[go: up one dir, main page]

Skip to content

Commit 28cd929

Browse files
committed
code style
1 parent 826c6b4 commit 28cd929

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

src/WebSocketsServer.cpp

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "WebSockets.h"
2626
#include "WebSocketsServer.h"
2727

28-
WebSocketsServerCore::WebSocketsServerCore(const String& origin, const String& protocol) {
28+
WebSocketsServerCore::WebSocketsServerCore(const String & origin, const String & protocol) {
2929
_origin = origin;
3030
_protocol = protocol;
3131
_runnning = false;
@@ -42,9 +42,9 @@ WebSocketsServerCore::WebSocketsServerCore(const String& origin, const String& p
4242
memset(&_clients[0], 0x00, (sizeof(WSclient_t) * WEBSOCKETS_SERVER_CLIENT_MAX));
4343
}
4444

45-
WebSocketsServer::WebSocketsServer(uint16_t port, const String& origin, const String& protocol):
46-
WebSocketsServerCore(origin, protocol) {
47-
_port = port;
45+
WebSocketsServer::WebSocketsServer(uint16_t port, const String & origin, const String & protocol)
46+
: WebSocketsServerCore(origin, protocol) {
47+
_port = port;
4848

4949
_server = new WEBSOCKETS_NETWORK_SERVER_CLASS(port);
5050

@@ -538,8 +538,7 @@ void WebSocketsServerCore::messageReceived(WSclient_t * client, WSopcode_t opcod
538538
* Discard a native client
539539
* @param client WSclient_t * ptr to the client struct contaning the native client "->tcp"
540540
*/
541-
void WebSocketsServerCore::dropNativeClient (WSclient_t * client)
542-
{
541+
void WebSocketsServerCore::dropNativeClient(WSclient_t * client) {
543542
if(client->tcp) {
544543
if(client->tcp->connected()) {
545544
#if(WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC) && (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP32)
@@ -631,25 +630,24 @@ bool WebSocketsServerCore::clientIsConnected(WSclient_t * client) {
631630
* Handle incoming Connection Request
632631
*/
633632
WSclient_t * WebSocketsServerCore::handleNewClient(WEBSOCKETS_NETWORK_CLASS * tcpClient) {
633+
WSclient_t * client = newClient(tcpClient);
634634

635-
WSclient_t * client = newClient(tcpClient);
636-
637-
if(!client) {
638-
// no free space to handle client
635+
if(!client) {
636+
// no free space to handle client
639637
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
640638
#ifndef NODEBUG_WEBSOCKETS
641-
IPAddress ip = tcpClient->remoteIP();
639+
IPAddress ip = tcpClient->remoteIP();
642640
#endif
643-
DEBUG_WEBSOCKETS("[WS-Server] no free space new client from %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
641+
DEBUG_WEBSOCKETS("[WS-Server] no free space new client from %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
644642
#else
645-
DEBUG_WEBSOCKETS("[WS-Server] no free space new client\n");
643+
DEBUG_WEBSOCKETS("[WS-Server] no free space new client\n");
646644
#endif
647-
dropNativeClient(client);
648-
}
645+
dropNativeClient(client);
646+
}
649647

650-
WEBSOCKETS_YIELD();
648+
WEBSOCKETS_YIELD();
651649

652-
return client;
650+
return client;
653651
}
654652

655653
/**
@@ -971,4 +969,3 @@ void WebSocketsServer::loop(void) {
971969
}
972970
}
973971
#endif
974-

0 commit comments

Comments
 (0)
0