• Carsten Haitzler (Rasterman)'s avatar
    ecore_con: bug workaround SO_REUSEADDR and EADDRINUSE from bind (fix) · 73b5982a
    Carsten Haitzler (Rasterman) authored
    what i'm seeing is this with local unix sockets:
    
    1. server process not cleanly shut down (kill -9 for example).
    2. run server process again and bind fails due to EADDRINUSE
    3. we ARE doing setsockopt() with SO_REUSEADDR set to 1 ...
    
    this just makes no sense because setsockopt() SHOULD allow use to
    re-use... the previous efreetd process for example is gone. no such
    process, yet socket is not re-usable. this should just not happen due
    to SO_REUSEADDR, but it does. this has nasty consequences like efreetd
    maybe never running because of stale sockets. this should never have
    happened, but it does. odd. so a hacky workaround:
    
    1. try bind.
    2. if bind fails with EADDRINUSE and its a socket path AND
    pd->unlink_before_bind is NOT set... then try a connect to the socket.
    3. if connect succeeds then fail as normal (close socket and error on
    bind'ing)
       if connect fails then we have a stale socket, so unlink it
    forcibly. create the socket again and try bind again.
    
    hacky but... fixes the core issue.
    
    @fix
    73b5982a
Name
Last commit
Last update
cmake Loading commit data...
cmakeconfig Loading commit data...
config Loading commit data...
data Loading commit data...
dbus-services Loading commit data...
doc Loading commit data...
licenses Loading commit data...
m4 Loading commit data...
old Loading commit data...
pc Loading commit data...
pkgbuild Loading commit data...
po Loading commit data...
spec Loading commit data...
src Loading commit data...
systemd-services Loading commit data...
.arcconfig Loading commit data...
.gitignore Loading commit data...
.lcov-config Loading commit data...
.mailmap Loading commit data...
AUTHORS Loading commit data...
CMakeLists.txt Loading commit data...
COMPLIANCE Loading commit data...
COPYING Loading commit data...
COPYING.images Loading commit data...
ChangeLog Loading commit data...
Makefile.am Loading commit data...
Makefile_Elm_Helpers.am Loading commit data...
NEWS Loading commit data...
NOTES Loading commit data...
README Loading commit data...
TODO-cmake.txt Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...
elm_intro.h.in Loading commit data...