File tree Expand file tree Collapse file tree 4 files changed +19
-11
lines changed
ArduinoCore-Linux/cores/arduino Expand file tree Collapse file tree 4 files changed +19
-11
lines changed Original file line number Diff line number Diff line change 2626#include " ArduinoLogger.h"
2727#include " RingBufferExt.h"
2828#include " SocketImpl.h"
29+ #include " SignalHandler.h"
2930#include " api/Client.h"
3031#include " api/Common.h"
3132#include " api/IPAddress.h"
@@ -81,14 +82,16 @@ class EthernetClient : public Client {
8182 active_clients ().push_back (this );
8283 }
8384 EthernetClient (SocketImpl* sock, int bufferSize = 256 , long timeout = 2000 ) {
84- setTimeout (timeout);
85- this ->bufferSize = bufferSize;
86- readBuffer = RingBufferExt (bufferSize);
87- writeBuffer = RingBufferExt (bufferSize);
88- p_sock = sock;
89- is_connected = p_sock->connected ();
90- registerCleanup ();
91- active_clients ().push_back (this );
85+ if (sock) {
86+ setTimeout (timeout);
87+ this ->bufferSize = bufferSize;
88+ readBuffer = RingBufferExt (bufferSize);
89+ writeBuffer = RingBufferExt (bufferSize);
90+ p_sock = sock;
91+ is_connected = p_sock->connected ();
92+ registerCleanup ();
93+ active_clients ().push_back (this );
94+ }
9295 }
9396 EthernetClient (int socket) {
9497 setTimeout (2000 );
Original file line number Diff line number Diff line change @@ -172,15 +172,15 @@ class EthernetServer : public Server {
172172 // non blocking check if we have any request to accept
173173 if (!is_blocking) {
174174 if (poll_rc <= 0 || !(pfd.revents & POLLIN)) {
175- EthernetClient result;
175+ EthernetClient result ( nullptr ) ;
176176 return result;
177177 }
178178 }
179179
180180 // accept client connection (blocking call)
181181 if ((client_fd = ::accept (server_fd, (struct sockaddr *)&client_addr,
182182 &client_addr_len)) < 0 ) {
183- EthernetClient result;
183+ EthernetClient result ( nullptr ) ;
184184 Logger.error (" accept failed" );
185185 return result;
186186 }
Original file line number Diff line number Diff line change 2525#include < map>
2626#include < algorithm>
2727
28+ #undef INADDR_NONE
29+
2830// Generic signal handler utility
2931class SignalHandler {
3032 public:
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ option(USE_HTTPS "Https Support" OFF)
99option (USE_RPI "Raspberry Pi Support" OFF )
1010option (USE_REMOTE "Remote API Support" OFF )
1111option (BUILD_SHARED_LIBS "Build with shared libraries" ON )
12+ option (BUILD_EXAMPLES "Build with examples" OFF )
1213
1314# Https support: Build with wolfssl
1415if (USE_HTTPS)
@@ -94,4 +95,6 @@ if(USE_FTDI)
9495endif (USE_FTDI)
9596
9697# build examples
97- add_subdirectory ("examples" )
98+ if (BUILD_EXAMPLES)
99+ add_subdirectory ("examples" )
100+ endif (BUILD_EXAMPLES)
You can’t perform that action at this time.
0 commit comments