Clear buffer on stop(). Fix #119
This commit is contained in:
@@ -72,6 +72,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual int connect(const char *host, uint16_t port) {
|
virtual int connect(const char *host, uint16_t port) {
|
||||||
|
stop();
|
||||||
TINY_GSM_YIELD();
|
TINY_GSM_YIELD();
|
||||||
rx.clear();
|
rx.clear();
|
||||||
sock_connected = at->modemConnect(host, port, mux);
|
sock_connected = at->modemConnect(host, port, mux);
|
||||||
@@ -95,6 +96,7 @@ public:
|
|||||||
at->sendAT(GF("+CIPCLOSE="), mux);
|
at->sendAT(GF("+CIPCLOSE="), mux);
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
at->waitResponse();
|
at->waitResponse();
|
||||||
|
rx.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t write(const uint8_t *buf, size_t size) {
|
virtual size_t write(const uint8_t *buf, size_t size) {
|
||||||
@@ -191,6 +193,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual int connect(const char *host, uint16_t port) {
|
virtual int connect(const char *host, uint16_t port) {
|
||||||
|
stop();
|
||||||
TINY_GSM_YIELD();
|
TINY_GSM_YIELD();
|
||||||
rx.clear();
|
rx.clear();
|
||||||
sock_connected = at->modemConnect(host, port, mux, true);
|
sock_connected = at->modemConnect(host, port, mux, true);
|
||||||
|
Reference in New Issue
Block a user