Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
6541-Make-start-failure-synchronous.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 6541-Make-start-failure-synchronous.patch of Package erlang
From 33db2733430c301ffb5a6f1d812b753d5be5d9bd Mon Sep 17 00:00:00 2001 From: Raimo Niskanen <raimo@erlang.org> Date: Tue, 8 Aug 2023 09:55:10 +0200 Subject: [PATCH 1/3] Make start failure synchronous The same functionality is already present in `proc_lib` on OTP 26.0 so when merging there this commit needs to be mostly ignored. --- lib/inets/src/http_server/httpd_acceptor.erl | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/inets/src/http_server/httpd_acceptor.erl b/lib/inets/src/http_server/httpd_acceptor.erl index d334b4d233..729558ed9f 100644 --- a/lib/inets/src/http_server/httpd_acceptor.erl +++ b/lib/inets/src/http_server/httpd_acceptor.erl @@ -37,12 +37,26 @@ start_link(Manager, SocketType, Addr, Port, IpFamily, ConfigDb, AcceptTimeout) -> Args = [self(), Manager, SocketType, Addr, Port, IpFamily, ConfigDb, AcceptTimeout], - proc_lib:start_link(?MODULE, acceptor_init, Args). + start_link(Args). start_link(Manager, SocketType, Addr, Port, ListenSocket, IpFamily, ConfigDb, AcceptTimeout) -> Args = [self(), Manager, SocketType, Addr, Port, ListenSocket, IpFamily, ConfigDb, AcceptTimeout], - proc_lib:start_link(?MODULE, acceptor_init, Args). + start_link(Args). + +%% This synchronization for server start error is solved in OTP-26.0 +%% through using proc_lib:init_fail/2 instead +%% +start_link(Args) -> + case proc_lib:start_link(?MODULE, acceptor_init, Args) of + {ok, _} = Result-> + Result; + {error, Pid, Error} -> + Mref = erlang:monitor(process, Pid), + receive {'DOWN', Mref, _, _, _} -> + Error + end + end. acceptor_init(Parent, Manager, SocketType, Addr, Port, {ListenOwner, ListenSocket}, IpFamily, ConfigDb, AcceptTimeout) -> @@ -66,7 +80,7 @@ acceptor_init(Parent, Manager, SocketType, Addr, Port, IpFamily, acceptor_loop(Manager, SocketType, Addr, Port, ListenSocket, IpFamily,ConfigDb, AcceptTimeout); Error -> - proc_lib:init_ack(Parent, Error), + proc_lib:init_ack(Parent, {error, self(), Error}), error end. -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor