[network/libktorrent] src/utp: ABI/API break: use enum class for utp::ConnectionState
Jack Hill <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 9d5a4fe5c5d47301a4e2c3e061f33968230b1a5d by Jack Hill.
Committed on 15/08/2026 at 10:18.
Pushed by jackh into branch 'master'.
ABI/API break: use enum class for utp::ConnectionState
No downstream changes required.
M +41 -41 src/utp/connection.cpp
M +1 -1 src/utp/tests/congestiontest.cpp
M +3 -3 src/utp/tests/connectiontest.cpp
M +3 -3 src/utp/tests/fintest.cpp
M +4 -4 src/utp/tests/packetlosstest.cpp
M +7 -7 src/utp/tests/transmittest.cpp
M +11 -11 src/utp/utpprotocol.h
M +3 -3 src/utp/utpserver.cpp
M +6 -6 src/utp/utpsocket.cpp
https://invent.kde.org/network/libktorrent/-/commit/9d5a4fe5c5d47301a4e2c3e061f33968230b1a5d
diff --git a/src/utp/connection.cpp b/src/utp/connection.cpp
index e360a459..77213bbb 100644
--- a/src/utp/connection.cpp
+++ b/src/utp/connection.cpp
@@ -51,7 +51,7 @@ Connection::Connection(bt::Uint16 recv_connection_id, Type type, const net::Addr
stats.send_connection_id = recv_connection_id + 1;
} else {
stats.send_connection_id = recv_connection_id - 1;
- stats.state = CS_IDLE;
+ stats.state = ConnectionState::IDLE;
stats.seq_nr = 5;
}
@@ -121,11 +121,11 @@ ConnectionState Connection::handlePacket(const PacketParser &parser, std::unique
const auto window_factor = remote_wnd->packetReceived(hdr, sack, this);
updateDelayMeasurement(hdr, window_factor);
switch (stats.state) {
- case CS_SYN_SENT:
+ case ConnectionState::SYN_SENT:
// now we should have a state packet
if (hdr->type == ST_STATE) {
// connection estabished
- stats.state = CS_CONNECTED;
+ stats.state = ConnectionState::CONNECTED;
local_wnd->setLastSeqNr(hdr->seq_nr - 1);
if (blocking) {
connected.wakeAll();
@@ -134,35 +134,35 @@ ConnectionState Connection::handlePacket(const PacketParser &parser, std::unique
Out(SYS_UTP | LOG_NOTICE) << "UTP: established connection with " << stats.remote.toString() << endl;
} else {
sendReset();
- stats.state = CS_CLOSED;
+ stats.state = ConnectionState::CLOSED;
if (blocking) {
data_ready.wakeAll();
}
}
break;
- case CS_IDLE:
+ case ConnectionState::IDLE:
if (hdr->type == ST_SYN) {
// Send back a state packet
local_wnd->setLastSeqNr(hdr->seq_nr);
sendState();
- stats.state = CS_CONNECTED;
+ stats.state = ConnectionState::CONNECTED;
stats.timeout = 1000;
Out(SYS_UTP | LOG_NOTICE) << "UTP: established connection with " << stats.remote.toString() << endl;
} else {
sendReset();
- stats.state = CS_CLOSED;
+ stats.state = ConnectionState::CLOSED;
if (blocking) {
data_ready.wakeAll();
}
}
break;
- case CS_CONNECTED:
+ case ConnectionState::CONNECTED:
if (hdr->type == ST_DATA) {
// push data into local window
if (!local_wnd->packetReceived(hdr, std::move(packet), data_off)) {
// Panick
sendReset();
- stats.state = CS_CLOSED;
+ stats.state = ConnectionState::CLOSED;
if (blocking) {
data_ready.wakeAll();
}
@@ -182,7 +182,7 @@ ConnectionState Connection::handlePacket(const PacketParser &parser, std::unique
} else if (hdr->type == ST_FIN) {
stats.eof_seq_nr = hdr->seq_nr;
// other side now has closed the connection
- stats.state = CS_FINISHED; // state becomes finished
+ stats.state = ConnectionState::FINISHED; // state becomes finished
sendPackets();
checkIfClosed();
if (blocking && local_wnd->isReadable() > 0) {
@@ -190,20 +190,20 @@ ConnectionState Connection::handlePacket(const PacketParser &parser, std::unique
}
} else {
sendReset();
- stats.state = CS_CLOSED;
+ stats.state = ConnectionState::CLOSED;
if (blocking) {
data_ready.wakeAll();
}
}
break;
- case CS_FINISHED:
+ case ConnectionState::FINISHED:
if (hdr->type == ST_DATA) {
if (SeqNrCmpSE(hdr->seq_nr, stats.eof_seq_nr)) {
// push data into local window
if (!local_wnd->packetReceived(hdr, std::move(packet), data_off)) {
// Panick
sendReset();
- stats.state = CS_CLOSED;
+ stats.state = ConnectionState::CLOSED;
if (blocking) {
data_ready.wakeAll();
}
@@ -213,7 +213,7 @@ ConnectionState Connection::handlePacket(const PacketParser &parser, std::unique
// send back an ACK
sendStateOrData();
- if (stats.state == CS_FINISHED && !fin_sent && output_buffer.size() == 0) {
+ if (stats.state == ConnectionState::FINISHED && !fin_sent && output_buffer.size() == 0) {
sendFIN();
fin_sent = true;
}
@@ -237,13 +237,13 @@ ConnectionState Connection::handlePacket(const PacketParser &parser, std::unique
}
} else {
sendReset();
- stats.state = CS_CLOSED;
+ stats.state = ConnectionState::CLOSED;
if (blocking) {
data_ready.wakeAll();
}
}
break;
- case CS_CLOSED:
+ case ConnectionState::CLOSED:
break;
}
@@ -255,8 +255,8 @@ ConnectionState Connection::handlePacket(const PacketParser &parser, std::unique
void Connection::checkState()
{
// Check if we have become readable or writeable, and notify if necessary
- const bool r = local_wnd->isReadable() > 0 || stats.state == CS_CLOSED;
- const bool w = remote_wnd->availableSpace() > 0 && stats.state == CS_CONNECTED;
+ const bool r = local_wnd->isReadable() > 0 || stats.state == ConnectionState::CLOSED;
+ const bool w = remote_wnd->availableSpace() > 0 && stats.state == ConnectionState::CONNECTED;
const bool r_changed = !stats.readable && r;
const bool w_changed = !stats.writeable && w;
stats.readable = r;
@@ -275,8 +275,8 @@ void Connection::checkIfClosed()
// Check if we need to go to the closed state
// We can do this if all our packets have been acked and the local window
// has been fully read
- if (stats.state == CS_FINISHED && remote_wnd->allPacketsAcked() && local_wnd->isEmpty()) {
- stats.state = CS_CLOSED;
+ if (stats.state == ConnectionState::FINISHED && remote_wnd->allPacketsAcked() && local_wnd->isEmpty()) {
+ stats.state = ConnectionState::CLOSED;
Out(SYS_UTP | LOG_NOTICE) << "UTP: Connection " << stats.recv_connection_id << "|" << stats.send_connection_id << " closed " << endl;
if (blocking) {
data_ready.wakeAll();
@@ -334,7 +334,7 @@ void Connection::sendPacket(Uint32 type, Uint16 p_ack_nr)
void Connection::sendSYN()
{
stats.seq_nr = 1;
- stats.state = CS_SYN_SENT;
+ stats.state = ConnectionState::SYN_SENT;
stats.timeout = CONNECT_TIMEOUT;
sendPacket(ST_SYN, 0);
stats.seq_nr++;
@@ -401,7 +401,7 @@ void Connection::updateDelayMeasurement(const utp::Header *hdr, double window_fa
int Connection::send(QByteArrayView data)
{
const QMutexLocker lock(&mutex);
- if (stats.state != CS_CONNECTED) {
+ if (stats.state != ConnectionState::CONNECTED) {
return -1;
}
@@ -434,7 +434,7 @@ void Connection::sendPackets()
stats.seq_nr++;
}
- if (stats.state == CS_FINISHED && !fin_sent && output_buffer.size() == 0) {
+ if (stats.state == ConnectionState::FINISHED && !fin_sent && output_buffer.size() == 0) {
sendFIN();
fin_sent = true;
} else {
@@ -503,17 +503,17 @@ bt::Uint32 Connection::bytesAvailable() const
bool Connection::isWriteable() const
{
const QMutexLocker lock(&mutex);
- return remote_wnd->availableSpace() > 0 && stats.state == CS_CONNECTED;
+ return remote_wnd->availableSpace() > 0 && stats.state == ConnectionState::CONNECTED;
}
int Connection::recv(Uint8 *buf, Uint32 max_len)
{
const QMutexLocker lock(&mutex);
- if (stats.state == CS_FINISHED) {
+ if (stats.state == ConnectionState::FINISHED) {
checkIfClosed();
}
- if (!local_wnd->bytesAvailable() && stats.state == CS_CLOSED) {
+ if (!local_wnd->bytesAvailable() && stats.state == ConnectionState::CLOSED) {
return -1;
}
@@ -531,12 +531,12 @@ int Connection::recv(Uint8 *buf, Uint32 max_len)
bool Connection::waitUntilConnected()
{
const QMutexLocker lock(&mutex);
- if (stats.state == CS_CONNECTED) {
+ if (stats.state == ConnectionState::CONNECTED) {
return true;
}
connected.wait(&mutex);
- return stats.state == CS_CONNECTED;
+ return stats.state == ConnectionState::CONNECTED;
}
bool Connection::waitForData(Uint32 timeout)
@@ -553,8 +553,8 @@ bool Connection::waitForData(Uint32 timeout)
void Connection::close()
{
const QMutexLocker lock(&mutex);
- if (stats.state == CS_CONNECTED) {
- stats.state = CS_FINISHED;
+ if (stats.state == ConnectionState::CONNECTED) {
+ stats.state = ConnectionState::FINISHED;
sendPackets();
}
}
@@ -562,9 +562,9 @@ void Connection::close()
void Connection::reset()
{
const QMutexLocker lock(&mutex);
- if (stats.state != CS_CLOSED) {
+ if (stats.state != ConnectionState::CLOSED) {
sendReset();
- stats.state = CS_CLOSED;
+ stats.state = ConnectionState::CLOSED;
remote_wnd->clear();
if (blocking) {
data_ready.wakeAll();
@@ -583,20 +583,20 @@ void Connection::checkTimeout(const TimeValue &now)
void Connection::handleTimeout()
{
switch (stats.state) {
- case CS_SYN_SENT:
+ case ConnectionState::SYN_SENT:
// No answer to SYN, so just close the connection
- stats.state = CS_CLOSED;
+ stats.state = ConnectionState::CLOSED;
if (blocking) {
connected.wakeAll();
}
break;
- case CS_FINISHED:
- stats.state = CS_CLOSED;
+ case ConnectionState::FINISHED:
+ stats.state = ConnectionState::CLOSED;
if (blocking) {
data_ready.wakeAll();
}
break;
- case CS_CONNECTED:
+ case ConnectionState::CONNECTED:
remote_wnd->timeout(this);
stats.packet_size = MIN_PACKET_SIZE;
stats.timeout *= 2;
@@ -604,7 +604,7 @@ void Connection::handleTimeout()
if (stats.timeout >= MAX_TIMEOUT) {
// If we have reached the max timeout, kill the connection
Out(SYS_UTP | LOG_DEBUG) << "Connection " << stats.recv_connection_id << "|" << stats.send_connection_id << " max timeout reached, closing" << endl;
- stats.state = CS_FINISHED;
+ stats.state = ConnectionState::FINISHED;
sendReset();
} else {
sendPackets();
@@ -614,15 +614,15 @@ void Connection::handleTimeout()
}
}
break;
- case CS_IDLE:
+ case ConnectionState::IDLE:
startTimer();
break;
- case CS_CLOSED:
+ case ConnectionState::CLOSED:
break;
}
checkState();
- if (stats.state == CS_CLOSED) {
+ if (stats.state == ConnectionState::CLOSED) {
transmitter->closed(self.toStrongRef());
}
}
diff --git a/src/utp/tests/congestiontest.cpp b/src/utp/tests/congestiontest.cpp
index fced3f1e..6bfbc5e6 100644
--- a/src/utp/tests/congestiontest.cpp
+++ b/src/utp/tests/congestiontest.cpp
@@ -147,7 +147,7 @@ private:
void testCongestionTest()
{
bt::Out(SYS_UTP | LOG_DEBUG) << "testCongestionTest" << bt::endl;
- if (outgoing->connectionState() != CS_CONNECTED || incoming->connectionState() != CS_CONNECTED) {
+ if (outgoing->connectionState() != ConnectionState::CONNECTED || incoming->connectionState() != ConnectionState::CONNECTED) {
QSKIP("Not Connected", SkipAll);
return;
}
diff --git a/src/utp/tests/connectiontest.cpp b/src/utp/tests/connectiontest.cpp
index fb3754d5..7ec1882f 100644
--- a/src/utp/tests/connectiontest.cpp
+++ b/src/utp/tests/connectiontest.cpp
@@ -96,14 +96,14 @@ private:
Connection conn(conn_id, utp::Connection::OUTGOING, remote, this);
conn.startConnecting();
const Connection::Stats &s = conn.connectionStats();
- QCOMPARE(s.state, utp::CS_SYN_SENT);
+ QCOMPARE(s.state, utp::ConnectionState::SYN_SENT);
QCOMPARE(s.seq_nr, 2);
auto pkt = buildPacket(ST_STATE, conn_id, conn_id + 1, 1, 1);
PacketParser pp(pkt->data(), pkt->size());
QVERIFY(pp.parse());
conn.handlePacket(pp, std::move(pkt));
- QCOMPARE(s.state, CS_CONNECTED);
+ QCOMPARE(s.state, ConnectionState::CONNECTED);
QCOMPARE(sent_packets.count(), 1);
}
@@ -116,7 +116,7 @@ private:
auto pkt = buildPacket(ST_SYN, conn_id - 1, conn_id, 1, 1);
const PacketParser pp(pkt->data(), pkt->size());
conn.handlePacket(pp, std::move(pkt));
- QCOMPARE(s.state, CS_CONNECTED);
+ QCOMPARE(s.state, ConnectionState::CONNECTED);
}
private:
diff --git a/src/utp/tests/fintest.cpp b/src/utp/tests/fintest.cpp
index 4fc0ca1e..0220af9d 100644
--- a/src/utp/tests/fintest.cpp
+++ b/src/utp/tests/fintest.cpp
@@ -66,7 +66,7 @@ private:
void testFin()
{
bt::Out(SYS_UTP | LOG_DEBUG) << "testFin" << bt::endl;
- if (outgoing->connectionState() != CS_CONNECTED || incoming->connectionState() != CS_CONNECTED) {
+ if (outgoing->connectionState() != ConnectionState::CONNECTED || incoming->connectionState() != ConnectionState::CONNECTED) {
QSKIP("Not Connected", SkipAll);
return;
}
@@ -82,13 +82,13 @@ private:
QCOMPARE(memcmp(tmp, test, strlen(test)), 0);
outgoing->close();
- if (incoming->connectionState() != CS_CLOSED) {
+ if (incoming->connectionState() != ConnectionState::CLOSED) {
incoming->waitForData();
}
// connection should be closed now
ret = incoming->recv(tmp, 100);
- QCOMPARE(incoming->connectionState(), CS_CLOSED);
+ QCOMPARE(incoming->connectionState(), ConnectionState::CLOSED);
QCOMPARE(ret, -1);
} else {
QFAIL("No data received");
diff --git a/src/utp/tests/packetlosstest.cpp b/src/utp/tests/packetlosstest.cpp
index db1f760b..1c6bf49f 100644
--- a/src/utp/tests/packetlosstest.cpp
+++ b/src/utp/tests/packetlosstest.cpp
@@ -79,7 +79,7 @@ public:
void run() override
{
int sent = 0;
- while (sent < PACKETS_TO_SEND && outgoing->connectionState() != CS_CLOSED) {
+ while (sent < PACKETS_TO_SEND && outgoing->connectionState() != ConnectionState::CLOSED) {
const int ret = outgoing->send(TEST_DATA);
if (ret > 0) {
sent++;
@@ -88,7 +88,7 @@ public:
msleep(200);
}
- while (!outgoing->allDataSent() && outgoing->connectionState() != CS_CLOSED) {
+ while (!outgoing->allDataSent() && outgoing->connectionState() != ConnectionState::CLOSED) {
sleep(1);
}
@@ -154,7 +154,7 @@ private:
void testPacketLoss()
{
bt::Out(SYS_UTP | LOG_DEBUG) << "testPacketLoss" << bt::endl;
- if (outgoing->connectionState() != CS_CONNECTED || incoming->connectionState() != CS_CONNECTED) {
+ if (outgoing->connectionState() != ConnectionState::CONNECTED || incoming->connectionState() != ConnectionState::CONNECTED) {
QSKIP("Not Connected", SkipAll);
return;
}
@@ -175,7 +175,7 @@ private:
received_data.append(QLatin1StringView(data));
received += ret;
}
- } else if (incoming->connectionState() == CS_CLOSED) {
+ } else if (incoming->connectionState() == ConnectionState::CLOSED) {
Out(SYS_UTP | LOG_DEBUG) << "Connection closed " << endl;
break;
} else {
diff --git a/src/utp/tests/transmittest.cpp b/src/utp/tests/transmittest.cpp
index ce6e59ba..096daebb 100644
--- a/src/utp/tests/transmittest.cpp
+++ b/src/utp/tests/transmittest.cpp
@@ -87,7 +87,7 @@ public:
bt::Int64 sent = 0;
int off = 0;
net::Poll poller;
- while (sent < BYTES_TO_SEND && outgoing->connectionState() != CS_CLOSED) {
+ while (sent < BYTES_TO_SEND && outgoing->connectionState() != ConnectionState::CLOSED) {
const int to_send = step - off;
const int ret = outgoing->send(data_view.sliced(off, to_send));
if (ret > 0) {
@@ -177,17 +177,17 @@ private Q_SLOTS:
exec();
QVERIFY(outgoing);
QVERIFY(incoming);
- QCOMPARE(incoming->connectionState(), CS_CONNECTED);
- if (outgoing->connectionState() != CS_CONNECTED) {
+ QCOMPARE(incoming->connectionState(), ConnectionState::CONNECTED);
+ if (outgoing->connectionState() != ConnectionState::CONNECTED) {
QVERIFY(outgoing->waitUntilConnected());
}
- QCOMPARE(outgoing->connectionState(), CS_CONNECTED);
+ QCOMPARE(outgoing->connectionState(), ConnectionState::CONNECTED);
}
void testThreaded()
{
bt::Out(SYS_UTP | LOG_DEBUG) << "testThreaded" << bt::endl;
- if (outgoing->connectionState() != CS_CONNECTED || incoming->connectionState() != CS_CONNECTED) {
+ if (outgoing->connectionState() != ConnectionState::CONNECTED || incoming->connectionState() != ConnectionState::CONNECTED) {
QSKIP("Not Connected", SkipAll);
return;
}
@@ -199,7 +199,7 @@ private Q_SLOTS:
bt::Int64 received = 0;
// int failures = 0;
incoming->setBlocking(true);
- while (received < BYTES_TO_SEND && incoming->connectionState() != CS_CLOSED) {
+ while (received < BYTES_TO_SEND && incoming->connectionState() != ConnectionState::CLOSED) {
const bt::Uint32 ba = incoming->bytesAvailable();
if (ba > 0) {
// failures = 0;
@@ -212,7 +212,7 @@ private Q_SLOTS:
received += ret;
// Out(SYS_UTP|LOG_DEBUG) << "Received " << received << endl;
}
- } else if (incoming->connectionState() != CS_CLOSED) {
+ } else if (incoming->connectionState() != ConnectionState::CLOSED) {
incoming->waitForData(1000);
}
}
diff --git a/src/utp/utpprotocol.h b/src/utp/utpprotocol.h
index 6f3c5e6f..2882fdb3 100644
--- a/src/utp/utpprotocol.h
+++ b/src/utp/utpprotocol.h
@@ -104,28 +104,28 @@ KTORRENT_EXPORT QString TypeToString(bt::Uint8 type);
*
* The current state of a UTP connection.
*
- * \var CS_IDLE
+ * \var IDLE
* Used for INCOMING connections before we have processed the first SYN packet.
*
- * \var CS_SYN_SENT
+ * \var SYN_SENT
* Used after an OUTGOING connection has sent a SYN packet.
*
- * \var CS_CONNECTED
+ * \var CONNECTED
* The SYN packet exchange has been successful.
*
- * \var CS_FINISHED
+ * \var FINISHED
* We have either sent or received an ST_FIN packet to close the connection. We can still receive packets in this state until all packets have been
* ACKed.
*
- * \var CS_CLOSED
+ * \var CLOSED
* The connection has been closed and no more packets will be sent or received.
*/
-enum ConnectionState {
- CS_IDLE,
- CS_SYN_SENT,
- CS_CONNECTED,
- CS_FINISHED,
- CS_CLOSED,
+enum class ConnectionState {
+ IDLE,
+ SYN_SENT,
+ CONNECTED,
+ FINISHED,
+ CLOSED,
};
const bt::Uint32 MIN_PACKET_SIZE = 150;
diff --git a/src/utp/utpserver.cpp b/src/utp/utpserver.cpp
index 3f7b17ca..92a763d2 100644
--- a/src/utp/utpserver.cpp
+++ b/src/utp/utpserver.cpp
@@ -321,7 +321,7 @@ void UTPServer::handlePacket(std::unique_ptr<bt::Buffer> buffer, const net::Addr
case ST_STATE:
try {
c = d->find(hdr->connection_id);
- if (c && c->handlePacket(parser, std::move(buffer)) == CS_CLOSED) {
+ if (c && c->handlePacket(parser, std::move(buffer)) == ConnectionState::CLOSED) {
d->connections.remove(c->receiveConnectionID());
}
} catch (Connection::TransmissionError &err) {
@@ -423,7 +423,7 @@ void UTPServer::preparePolling(net::Poll *p, net::Poll::Mode mode, utp::Connecti
return;
}
- if (conn->bytesAvailable() > 0 || conn->connectionState() == CS_CLOSED) {
+ if (conn->bytesAvailable() > 0 || conn->connectionState() == ConnectionState::CLOSED) {
pair->read_pipe->wakeUp();
}
pair->read_pipe->prepare(p, conn->receiveConnectionID(), pair->read_pipe);
@@ -469,7 +469,7 @@ void UTPServer::cleanup()
const QMutexLocker lock(&d->mutex);
QMap<quint16, Connection::Ptr>::iterator i = d->connections.begin();
while (i != d->connections.end()) {
- if (i.value()->connectionState() == CS_CLOSED) {
+ if (i.value()->connectionState() == ConnectionState::CLOSED) {
i = d->connections.erase(i);
} else {
++i;
diff --git a/src/utp/utpsocket.cpp b/src/utp/utpsocket.cpp
index 60124468..a8980270 100644
--- a/src/utp/utpsocket.cpp
+++ b/src/utp/utpsocket.cpp
@@ -65,7 +65,7 @@ void UTPSocket::close()
bool UTPSocket::connectSuccessful()
{
const Connection::Ptr ptr = conn.toStrongRef();
- if (ptr && ptr->connectionState() == CS_CONNECTED) {
+ if (ptr && ptr->connectionState() == ConnectionState::CONNECTED) {
setRemoteAddress(ptr->remoteAddress());
m_state = CONNECTED;
return true;
@@ -100,7 +100,7 @@ bool UTPSocket::connectTo(const net::Address &addr)
return ret;
}
- return ptr->connectionState() == CS_CONNECTED;
+ return ptr->connectionState() == ConnectionState::CONNECTED;
}
int UTPSocket::fd() const
@@ -129,13 +129,13 @@ net::Address UTPSocket::getSockName() const
bool UTPSocket::ok() const
{
const Connection::Ptr ptr = conn.toStrongRef();
- return ptr && ptr->connectionState() != CS_CLOSED;
+ return ptr && ptr->connectionState() != ConnectionState::CLOSED;
}
int UTPSocket::recv(bt::Uint8 *buf, int max_len)
{
const Connection::Ptr ptr = conn.toStrongRef();
- if (!ptr || ptr->connectionState() == CS_CLOSED) {
+ if (!ptr || ptr->connectionState() == ConnectionState::CLOSED) {
return 0;
}
@@ -197,7 +197,7 @@ bool UTPSocket::setTOS(unsigned char type_of_service)
void UTPSocket::prepare(net::Poll *p, net::Poll::Mode mode)
{
Connection::Ptr ptr = conn.toStrongRef();
- if (ptr && ptr->connectionState() != CS_CLOSED) {
+ if (ptr && ptr->connectionState() != ConnectionState::CLOSED) {
UTPServer &srv = bt::Globals::instance().getUTPServer();
srv.preparePolling(p, mode, ptr);
if (mode == net::Poll::OUTPUT) {
@@ -224,7 +224,7 @@ bool UTPSocket::ready(const net::Poll *p, net::Poll::Mode mode) const
} else {
if (polled_for_reading) {
polled_for_reading = false;
- return bytesAvailable() > 0 || ptr->connectionState() == CS_CLOSED;
+ return bytesAvailable() > 0 || ptr->connectionState() == ConnectionState::CLOSED;
}
}