Skip to content

Commit

Permalink
Remove redundant Socket::isClosed()
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Göthel <[email protected]>
Change-Id: Iad74f253bdac5636757b130b299b5deacda658db
  • Loading branch information
Sven Göthel committed Nov 1, 2024
1 parent 8ced25f commit b5cd651
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions net/WebSocketHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class WebSocketHandler : public ProtocolHandlerInterface
return;
}

if (socket->isClosed())
if (!socket->isOpen())
{
LOG_DBG("Socket is closed. Cannot send Close Frame");
return;
Expand Down Expand Up @@ -261,7 +261,7 @@ class WebSocketHandler : public ProtocolHandlerInterface
bool isConnected() const
{
std::shared_ptr<StreamSocket> socket = _socket.lock();
return socket && !socket->isClosed();
return socket && socket->isOpen();
}

private:
Expand Down Expand Up @@ -823,7 +823,7 @@ class WebSocketHandler : public ProtocolHandlerInterface
return -1;
}

if (socket->isClosed())
if (!socket->isOpen())
{
LOG_DBG("Socket is closed. Cannot send WS frame");
return 0;
Expand Down
4 changes: 2 additions & 2 deletions wsd/ClientRequestDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ void ClientRequestDispatcher::handleIncomingMessage(SocketDisposition& dispositi
socket->eraseFirstInputBytes(map._messageSize - map._headerSize);
}
}
if( servedSync && closeConnection && !socket->isClosed() )
if( servedSync && closeConnection && socket->isOpen() )
{
LOG_DBG("Handled request: " << request.getURI()
<< ", inBuf[sz " << preInBufferSz << " -> " << socket->getInBuffer().size()
Expand All @@ -969,7 +969,7 @@ void ClientRequestDispatcher::handleIncomingMessage(SocketDisposition& dispositi
LOG_DBG("Handled request: " << request.getURI()
<< ", inBuf[sz " << preInBufferSz << " -> " << socket->getInBuffer().size()
<< ", rm " << (preInBufferSz-socket->getInBuffer().size())
<< "], connection open " << !socket->isClosed());
<< "], connection open " << socket->isOpen());

#else // !MOBILEAPP
Poco::Net::HTTPRequest request;
Expand Down

0 comments on commit b5cd651

Please sign in to comment.