File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,12 @@ WiFiClient::WiFiClient(const WiFiClient& c) {
2828/* -------------------------------------------------------------------------- */
2929void WiFiClient::getSocket () {
3030/* -------------------------------------------------------------------------- */
31+ if (_sock >= 0 && !connected ()) {
32+ // if sock >= 0 -> it means we were connected, but something happened and we need
33+ // to reset this socket in order to be able to connect again
34+ stop ();
35+ }
36+
3137 if (_sock == -1 ) {
3238 string res = " " ;
3339 modem.begin ();
Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ WiFiSSLClient::~WiFiSSLClient() {
1616/* -------------------------------------------------------------------------- */
1717void WiFiSSLClient::getSocket () {
1818/* -------------------------------------------------------------------------- */
19+ if (_sock >= 0 && !connected ()) {
20+ // if sock >= 0 -> it means we were connected, but something happened and we need
21+ // to reset this socket in order to be able to connect again
22+ stop ();
23+ }
24+
1925 if (_sock == -1 ) {
2026 string res = " " ;
2127 modem.begin ();
You can’t perform that action at this time.
0 commit comments