Skip to content

Commit

Permalink
EspAtDrv.cpp - in close() always clear link.available
Browse files Browse the repository at this point in the history
it was not cleared if TCP connection was already closed in readRX()
  • Loading branch information
JAndrassy committed Feb 23, 2020
1 parent ae70242 commit a07afe2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/utility/EspAtDrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,14 +663,13 @@ bool EspAtDrvClass::close(uint8_t linkId, bool abort) {
LOG_INFO_PRINTLN(linkId);

LinkInfo& link = linkInfo[linkId];
link.available = 0;
if (!link.isConnected()) {
LOG_WARN_PRINT_PREFIX();
LOG_WARN_PRINTLN(F("link is not active"));
lastErrorCode = EspAtDrvError::LINK_NOT_ACTIVE;
LOG_INFO_PRINT_PREFIX();
LOG_INFO_PRINTLN(F("link is already closed"));
return true;
}
link.flags |= LINK_CLOSING;
link.available = 0;
if (abort) {
cmd->print(F("AT+CIPCLOSEMODE="));
cmd->print(linkId);
Expand Down Expand Up @@ -1096,7 +1095,7 @@ uint8_t EspAtDrvClass::freeLinkId() {
LinkInfo& link = linkInfo[linkId];
if (!link.isConnected() && !link.isClosing()) {
LOG_INFO_PRINT_PREFIX();
LOG_INFO_PRINT(F("free linkId "));
LOG_INFO_PRINT(F("free linkId is "));
LOG_INFO_PRINTLN(linkId);
return linkId;
}
Expand Down

0 comments on commit a07afe2

Please sign in to comment.