File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
libraries/SocketWrapper/src Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change 3636namespace arduino {
3737
3838class MbedClient : public arduino ::Client {
39+ private:
40+ // Helper for copy constructor and assignment operator
41+ void copyClient (const MbedClient& orig) {
42+ auto _sock = orig.sock ;
43+ auto _m = (MbedClient*)&orig;
44+ _m->borrowed_socket = true ;
45+ _m->stop ();
46+ this ->setSocket (_sock);
47+ }
3948
4049public:
4150 MbedClient ();
@@ -44,13 +53,14 @@ class MbedClient : public arduino::Client {
4453 // needs to "survive" event if it goes out of scope
4554 // Sample usage: Client* new_client = new Client(existing_client)
4655 MbedClient (const MbedClient& orig) {
47- auto _sock = orig.sock ;
48- auto _m = (MbedClient*)&orig;
49- _m->borrowed_socket = true ;
50- _m->stop ();
51- this ->setSocket (_sock);
56+ copyClient (orig);
5257 }
5358
59+ MbedClient& operator =(const MbedClient& orig) {
60+ copyClient (orig);
61+ return *this ;
62+ }
63+
5464 virtual ~MbedClient () {
5565 stop ();
5666 }
@@ -76,6 +86,9 @@ class MbedClient : public arduino::Client {
7686 }
7787
7888 void setSocket (Socket* _sock);
89+ Socket* getSocket () { return sock; };
90+ RingBufferN<SOCKET_BUFFER_SIZE> *getRxBuffer () { return &rxBuffer; };
91+
7992 void configureSocket (Socket* _s);
8093
8194 IPAddress remoteIP ();
You can’t perform that action at this time.
0 commit comments