mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Unix sockets: remove on closing only the file this socket bound
When a reload cannot take a listening Unix socket over (a bind-time -ol option changed), the new service binds the path anew, and the old listener, closing after it, removed the file, the new socket's by then, leaving nothing to connect to. The socket's file (device and inode) is now noted on binding and the path removed on closing only if it is still that file. structures.h includes <stddef.h> for offsetof() in SASIZE(), which needs it wherever the header is used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9612bbdd22
commit
5c19e6368f
3 files changed
+45
-2
No files matched your search
@@ -157,6 +157,18 @@ def run(t):
|
||||
t.fail("its file is still there", path, "missing")
|
||||
t.eq((200, 1000), unix_get(path, url), "and the proxy answers on it")
|
||||
|
||||
# --- a bind-time option changed: a new socket on the same path, and
|
||||
# the old one, closing after, must not remove the new one's file -------
|
||||
t.write_config("unixsock", config().replace(f"proxy -iunix:{path}",
|
||||
f"proxy -olSO_REUSEADDR=0 -iunix:{path}"))
|
||||
t.http(f"http://127.0.0.1:{adm}/R")
|
||||
# the old services stop within a second of the reload
|
||||
time.sleep(2)
|
||||
t.ok("a new socket on the same path keeps its file when the old one closes") \
|
||||
if os.path.exists(path) else \
|
||||
t.fail("a new socket on the same path keeps its file when the old one closes", path, "missing")
|
||||
t.eq((200, 1000), unix_get(path, url), "and the proxy answers on it")
|
||||
|
||||
# --- no service listens there any more: the file goes -------------------
|
||||
t.write_config("unixsock", config(unix=False))
|
||||
t.http(f"http://127.0.0.1:{adm}/R")
|
||||
|
||||
Reference in new issue
Block a user