diff -ur otp_src_R11B-4-orig/lib/ssl/c_src/esock.c otp_src_R11B-4/lib/ssl/c_src/esock.c --- otp_src_R11B-4-orig/lib/ssl/c_src/esock.c 2007-05-21 11:32:22.859804816 +0100 +++ otp_src_R11B-4/lib/ssl/c_src/esock.c 2007-05-21 13:38:51.000000000 +0100 @@ -877,7 +877,7 @@ if (esock_ssl_accept(cp) < 0) { if (sock_errno() != ERRNO_BLOCK) { /* Handshake failed. */ - reply(ESOCK_TRANSPORT_ACCEPT_ERR, "4s", cp->listen_fd, + reply(ESOCK_SSL_ACCEPT_ERR, "4s", msgsock, ssl_errstr()); DEBUGF(("ERROR: handshake: %s\n", ssl_errstr())); close_and_remove_connection(cp); diff -ur otp_src_R11B-4-orig/lib/ssl/src/ssl_server.erl otp_src_R11B-4/lib/ssl/src/ssl_server.erl --- otp_src_R11B-4-orig/lib/ssl/src/ssl_server.erl 2007-05-21 11:32:22.863804208 +0100 +++ otp_src_R11B-4/lib/ssl/src/ssl_server.erl 2007-05-21 17:34:11.728254296 +0100 @@ -541,18 +541,27 @@ %% ssl_accept %% ?SSL_ACCEPT_ERR when size(Bin) >= 5 -> - {ListenFd, Reason} = decode_msg(Bin, [int32, atom]), - debug(St, "ssl_accept_err: listenfd = ~w, " - "reason = ~w~n", [ListenFd, Reason]), - %% JC: remove this? - case delete_last_by_fd(ListenFd, St#st.paccepts) of - {ok, {_, _, From}, PAccepts} -> - gen_server:reply(From, {error, Reason}), - {noreply, St#st{paccepts = PAccepts}}; - _Other -> - %% Already closed - {noreply, St} - end; + {Fd, Reason} = decode_msg(Bin, [int32, atom]), + debug(St, "ssl_accept_err: fd = ~w, " + "reason = ~w~n", [Fd, Reason]), + case delete_by_fd(Fd, St#st.cons) of + {ok, {_, _, From}, Cons} -> + %% Fd not yet published - hence close ourselves + gen_server:reply(From, {error, Reason}), + {noreply, St#st{cons = Cons}}; + _Other -> + %% Already closed + {noreply, St} + end; +%% %% JC: remove this? +%% case delete_last_by_fd(ListenFd, St#st.paccepts) of +%% {ok, {_, _, From}, PAccepts} -> +%% gen_server:reply(From, {error, Reason}), +%% {noreply, St#st{paccepts = PAccepts}}; +%% _Other -> +%% %% Already closed +%% {noreply, St} +%% end; ?SSL_ACCEPT_REP when size(Bin) >= 5 -> Fd = decode_msg(Bin, [int32]), debug(St, "ssl_accept_rep: Fd = ~w\n", [Fd]),