Martin,
Just tried the latest version and the problem with stuck port persists, suggesting that either Ubuntu is doing something funny or that the destructor is to blame.
A simple test to perform is to use attached test patch:
1) Connect the client 2) Close the patch without explicitly disconnecting the client 3) Reopen the patch and the tcpserver will fail to be created until the timeout has taken place (on my machine 60 seconds)
Console output in this case is:
tcpserver listening on port 9999 tcpclient 2010 Martin Peach-style tcpclient: connecting socket 8 to port 9999 tcpserver: accepted connection from 127.0.0.1 on socket 9 tcp_server_free... ...tcp_server_free tcpclient_free... tcpclient: disconnected ...tcpclient_free
However, if one explicitly disconnects before closing the patch, that works just fine:
tcpserver listening on port 9999 tcpclient 2010 Martin Peach-style tcpclient: connecting socket 8 to port 9999 tcpserver: accepted connection from 127.0.0.1 on socket 9 tcpclient: disconnected tcpserver: connection closed on socket 9 tcpserver: "127.0.0.1" removed from list of clients tcp_server_free... ...tcp_server_free tcpclient_free... tcpclient: not connected ...tcpclient_free
Notice how in the first case there is never a "disconnect" taking place. Hence the problem.
In production environment it would be silly to require everyone to explicitly disconnect when closing the patch. IMO these things should happen automagically when closing the patch.
Best wishes,
Ico