Skip to content

Commit

Permalink
Host server socket doesn't get closed as expected
Browse files Browse the repository at this point in the history
Because CSocket virtual destructor calls virtual `close` method which doesn't behave as expected.
This one's simple to fix but there are some other cases in the framework (Networking) which will need to be looked at separately.
  • Loading branch information
mikee47 committed Apr 21, 2024
1 parent 1fecd1b commit ee80185
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Sming/Arch/Host/Components/hostlib/sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ class CSocket
assign(fd, addr);
}

virtual ~CSocket()
~CSocket()
{
close();
}

virtual void close();
void close();

bool setblocking(bool block);
bool bind(const CSockAddr& sa);
Expand Down Expand Up @@ -217,7 +217,12 @@ class CServerSocket : public CSocket
{
}

void close() override
virtual ~CServerSocket()
{
close();
}

void close()
{
m_clients.closeall();
CSocket::close();
Expand Down

0 comments on commit ee80185

Please sign in to comment.