Repository navigation
feat(socket): rely on acceptors to notify listen socket closed - #229
Merged
Merged
Conversation
This commit changes `esockd_socket_listener` implementation: now there's no `socket:monitor/1` call. This call forces use of socket registry for the listen socket and ALL subsequently accepted socket. This helps to avoid small extra memory cost per each `esockd_socket` connection.
zmstone
reviewed
Sep 3, 2026
| {noreply, State}. | ||
|
|
||
| handle_info({'DOWN', _MRef, socket, LSock, Info}, #state{lsock = LSock} = State) -> | ||
| error_logger:error_msg("[~s] Socket ~p closed: ~p", [?MODULE, LSock, Info]), |
Contributor
Author
There was a problem hiding this comment.
Right. The reasoning is that an OTP error report will follow anyway, since the listener terminates with abnormal reason.
zmstone
reviewed
Sep 3, 2026
|
|
||
| init([ListenerRef, ConnSup, {Mod, Opts}, UpgradeFuns, Limiter, LSock]) -> | ||
| _ = erlang:process_flag(trap_exit, true), | ||
| {_Mod, Listener} = esockd_server:get_listener_prop(ListenerRef, listener), |
Contributor
Author
There was a problem hiding this comment.
It's set in esockd_socket_listener:start_supervised/1, which completes before any acceptors are started.
zmstone
approved these changes
Sep 3, 2026
1 of 3 tasks
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR changes
esockd_socket_listenerimplementation: now there's nosocket:monitor/1call.This call forced use of socket registry facility for the listen socket and ALL subsequently accepted sockets. When socket registry is disabled, this helps to avoid small extra memory cost per each
esockd_socketconnection.