Propogate fixes to stop
This commit is contained in:
		@@ -89,10 +89,20 @@ public:
 | 
			
		||||
 | 
			
		||||
  virtual void stop() {
 | 
			
		||||
    TINY_GSM_YIELD();
 | 
			
		||||
    // Read and dump anything remaining in the modem's internal buffer.
 | 
			
		||||
    // The socket will appear open in response to connected() even after it
 | 
			
		||||
    // closes until all data is read from the buffer.
 | 
			
		||||
    // Doing it this way allows the external mcu to find and get all of the data
 | 
			
		||||
    // that it wants from the socket even if it was closed externally.
 | 
			
		||||
    at->maintain();
 | 
			
		||||
    while (sock_available > 0) {
 | 
			
		||||
      sock_available -= at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux);
 | 
			
		||||
      rx.clear();
 | 
			
		||||
      at->maintain();
 | 
			
		||||
    }
 | 
			
		||||
    at->sendAT(GF("+QICLOSE="), mux);
 | 
			
		||||
    sock_connected = false;
 | 
			
		||||
    at->waitResponse();
 | 
			
		||||
    rx.clear();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  virtual size_t write(const uint8_t *buf, size_t size) {
 | 
			
		||||
 
 | 
			
		||||
@@ -89,10 +89,20 @@ public:
 | 
			
		||||
 | 
			
		||||
  virtual void stop() {
 | 
			
		||||
    TINY_GSM_YIELD();
 | 
			
		||||
    // Read and dump anything remaining in the modem's internal buffer.
 | 
			
		||||
    // The socket will appear open in response to connected() even after it
 | 
			
		||||
    // closes until all data is read from the buffer.
 | 
			
		||||
    // Doing it this way allows the external mcu to find and get all of the data
 | 
			
		||||
    // that it wants from the socket even if it was closed externally.
 | 
			
		||||
    at->maintain();
 | 
			
		||||
    while (sock_available > 0) {
 | 
			
		||||
      sock_available -= at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux);
 | 
			
		||||
      rx.clear();
 | 
			
		||||
      at->maintain();
 | 
			
		||||
    }
 | 
			
		||||
    at->sendAT(GF("+QICLOSE="), mux);
 | 
			
		||||
    sock_connected = false;
 | 
			
		||||
    at->waitResponse(60000L, GF("CLOSED"), GF("CLOSE OK"), GF("ERROR"));
 | 
			
		||||
    rx.clear();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  virtual size_t write(const uint8_t *buf, size_t size) {
 | 
			
		||||
 
 | 
			
		||||
@@ -93,10 +93,20 @@ public:
 | 
			
		||||
 | 
			
		||||
  virtual void stop() {
 | 
			
		||||
    TINY_GSM_YIELD();
 | 
			
		||||
    // Read and dump anything remaining in the modem's internal buffer.
 | 
			
		||||
    // The socket will appear open in response to connected() even after it
 | 
			
		||||
    // closes until all data is read from the buffer.
 | 
			
		||||
    // Doing it this way allows the external mcu to find and get all of the data
 | 
			
		||||
    // that it wants from the socket even if it was closed externally.
 | 
			
		||||
    at->maintain();
 | 
			
		||||
    while (sock_available > 0) {
 | 
			
		||||
      sock_available -= at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux);
 | 
			
		||||
      rx.clear();
 | 
			
		||||
      at->maintain();
 | 
			
		||||
    }
 | 
			
		||||
    at->sendAT(GF("+QICLOSE="), mux);
 | 
			
		||||
    sock_connected = false;
 | 
			
		||||
    at->waitResponse(60000L, GF("CLOSED"), GF("CLOSE OK"), GF("ERROR"));
 | 
			
		||||
    rx.clear();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  virtual size_t write(const uint8_t *buf, size_t size) {
 | 
			
		||||
 
 | 
			
		||||
@@ -95,10 +95,20 @@ public:
 | 
			
		||||
 | 
			
		||||
  virtual void stop() {
 | 
			
		||||
    TINY_GSM_YIELD();
 | 
			
		||||
    // Read and dump anything remaining in the modem's internal buffer.
 | 
			
		||||
    // The socket will appear open in response to connected() even after it
 | 
			
		||||
    // closes until all data is read from the buffer.
 | 
			
		||||
    // Doing it this way allows the external mcu to find and get all of the data
 | 
			
		||||
    // that it wants from the socket even if it was closed externally.
 | 
			
		||||
    at->maintain();
 | 
			
		||||
    while (sock_available > 0) {
 | 
			
		||||
      sock_available -= at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux);
 | 
			
		||||
      rx.clear();
 | 
			
		||||
      at->maintain();
 | 
			
		||||
    }
 | 
			
		||||
    at->sendAT(GF("+CIPCLOSE="), mux);
 | 
			
		||||
    sock_connected = false;
 | 
			
		||||
    at->waitResponse();
 | 
			
		||||
    rx.clear();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  virtual size_t write(const uint8_t *buf, size_t size) {
 | 
			
		||||
 
 | 
			
		||||
@@ -86,9 +86,11 @@ public:
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  virtual void stop() {
 | 
			
		||||
    // Read and dump anything remaining in the u-blox buffer
 | 
			
		||||
    // Read and dump anything remaining in the modem's internal buffer.
 | 
			
		||||
    // The socket will appear open in response to connected() even after it
 | 
			
		||||
    // closes until all data is read from the buffer.
 | 
			
		||||
    // Doing it this way allows the external mcu to find and get all of the data
 | 
			
		||||
    // that it wants from the socket even if it was closed externally.
 | 
			
		||||
    at->maintain();
 | 
			
		||||
    while (sock_available > 0) {
 | 
			
		||||
      sock_available -= at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user