Currently on Linux when building maps with Build Process Monitoring enabled, there is a high chance that the build won't start, throwing the following failure instead:
Failed to get a listening socket on port 39000.
Try running with Build monitoring disabled if you can't fix this.
This error occurs when Radiant attempts to re-bind the 39000 TCP socket in libs/l_net/l_net_berkley.c.
It does not look to be a timing issue, as Radiant seems to correctly order the steps of attempting to close the 39000 TCP socket connection before recreating it again.
The following commit resolves this issue in the following ways:
Firstly the socket option SO_REUSEADDR is used to allow new sockets to rebind to an address that is already in use.
Secondly sockets are now shutdown more cleanly via shutdown using SHUT_RDWR, which immediately aborts standing/queued communication.
Merely closing a socket on Linux does apparently not "invalidate" the "socket cache", and can therefore disallow rebinding the same address, even despite using SO_REUSEADDR.
As such both changes are required in tandem to resolve the issue.
Currently on Linux when building maps with
Build Process Monitoring
enabled, there is a high chance that the build won't start, throwing the following failure instead:This error occurs when Radiant attempts to re-bind the 39000 TCP socket in
libs/l_net/l_net_berkley.c
.It does not look to be a timing issue, as Radiant seems to correctly order the steps of attempting to close the 39000 TCP socket connection before recreating it again.
The following commit resolves this issue in the following ways:
Firstly the socket option
SO_REUSEADDR
is used to allow new sockets to rebind to an address that is already in use.Secondly sockets are now shutdown more cleanly via
shutdown
usingSHUT_RDWR
, which immediately aborts standing/queued communication.Merely closing a socket on Linux does apparently not "invalidate" the "socket cache", and can therefore disallow rebinding the same address, even despite using
SO_REUSEADDR
.As such both changes are required in tandem to resolve the issue.