Skip to content

Commit

Permalink
Changed numbers to enum for _pcb->state
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Sep 9, 2024
1 parent ea65eed commit 5093f8d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/AsyncTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ int8_t AsyncClient::abort(){
}

size_t AsyncClient::space(){
if((_pcb != NULL) && (_pcb->state == 4)){
if((_pcb != NULL) && (_pcb->state == ESTABLISHED)){
return tcp_sndbuf(_pcb);
}
return 0;
Expand Down Expand Up @@ -1081,7 +1081,7 @@ bool AsyncClient::free(){
if(!_pcb) {
return true;
}
if(_pcb->state == 0 || _pcb->state > 4) {
if(_pcb->state == CLOSED || _pcb->state > ESTABLISHED) {
return true;
}
return false;
Expand Down Expand Up @@ -1284,35 +1284,35 @@ bool AsyncClient::connected(){
if (!_pcb) {
return false;
}
return _pcb->state == 4;
return _pcb->state == ESTABLISHED;
}

bool AsyncClient::connecting(){
if (!_pcb) {
return false;
}
return _pcb->state > 0 && _pcb->state < 4;
return _pcb->state > CLOSED && _pcb->state < ESTABLISHED;
}

bool AsyncClient::disconnecting(){
if (!_pcb) {
return false;
}
return _pcb->state > 4 && _pcb->state < 10;
return _pcb->state > ESTABLISHED && _pcb->state < TIME_WAIT;
}

bool AsyncClient::disconnected(){
if (!_pcb) {
return true;
}
return _pcb->state == 0 || _pcb->state == 10;
return _pcb->state == CLOSED || _pcb->state == TIME_WAIT;
}

bool AsyncClient::freeable(){
if (!_pcb) {
return true;
}
return _pcb->state == 0 || _pcb->state > 4;
return _pcb->state == CLOSED || _pcb->state > ESTABLISHED;
}

bool AsyncClient::canSend(){
Expand Down

0 comments on commit 5093f8d

Please sign in to comment.