From 5093f8dbcdb3fcda0f2922f4d145d0d3f52ee36c Mon Sep 17 00:00:00 2001 From: Mathieu Carbou Date: Mon, 9 Sep 2024 22:25:40 +0200 Subject: [PATCH] Changed numbers to enum for _pcb->state --- src/AsyncTCP.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/AsyncTCP.cpp b/src/AsyncTCP.cpp index ea695ef..8ad7d29 100644 --- a/src/AsyncTCP.cpp +++ b/src/AsyncTCP.cpp @@ -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; @@ -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; @@ -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(){