couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [42/45] mochiweb commit: updated refs/heads/master to cb521b3
Date Tue, 25 Aug 2015 17:39:00 GMT
Revert "Fix Mochiweb acceptor blocked in ssl handshake"

This reverts commit 432c9495fa8b90a359c9ed766302d232cb11e27f.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/commit/4b9ff7a4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/4b9ff7a4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/4b9ff7a4

Branch: refs/heads/master
Commit: 4b9ff7a4226800db4e13873d0f54cc20e73153f0
Parents: 80e37c9
Author: Robert Newson <rnewson@apache.org>
Authored: Tue Aug 25 18:26:49 2015 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Tue Aug 25 18:26:49 2015 +0100

----------------------------------------------------------------------
 src/mochiweb_acceptor.erl |  7 +++----
 src/mochiweb_socket.erl   | 15 ++++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/4b9ff7a4/src/mochiweb_acceptor.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_acceptor.erl b/src/mochiweb_acceptor.erl
index 6c7cfa3..ebbaf45 100644
--- a/src/mochiweb_acceptor.erl
+++ b/src/mochiweb_acceptor.erl
@@ -18,14 +18,13 @@ init(Server, Listen, Loop) ->
     case catch mochiweb_socket:accept(Listen) of
         {ok, Socket} ->
             gen_server:cast(Server, {accepted, self(), timer:now_diff(os:timestamp(), T1)}),
-            case mochiweb_socket:after_accept(Socket) of
-                ok -> call_loop(Loop, Socket);
-                {error, _} -> exit(normal)
-            end;
+            call_loop(Loop, Socket);
         {error, closed} ->
             exit(normal);
         {error, timeout} ->
             init(Server, Listen, Loop);
+        {error, esslaccept} ->
+            exit(normal);
         Other ->
             error_logger:error_report(
               [{application, mochiweb},

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/4b9ff7a4/src/mochiweb_socket.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_socket.erl b/src/mochiweb_socket.erl
index ad27204..76b018c 100644
--- a/src/mochiweb_socket.erl
+++ b/src/mochiweb_socket.erl
@@ -4,11 +4,10 @@
 
 -module(mochiweb_socket).
 
--export([listen/4, accept/1, after_accept/1, recv/3, send/2, close/1, port/1, peername/1,
+-export([listen/4, accept/1, recv/3, send/2, close/1, port/1, peername/1,
          setopts/2, type/1]).
 
 -define(ACCEPT_TIMEOUT, 2000).
--define(SSL_ACCEPT_TIMEOUT, 30000).
 
 listen(Ssl, Port, Opts, SslOpts) ->
     case Ssl of
@@ -26,9 +25,14 @@ listen(Ssl, Port, Opts, SslOpts) ->
 accept({ssl, ListenSocket}) ->
     % There's a bug in ssl:transport_accept/2 at the moment, which is the
     % reason for the try...catch block. Should be fixed in OTP R14.
-    try ssl:transport_accept(ListenSocket, ?ACCEPT_TIMEOUT) of
+    try ssl:transport_accept(ListenSocket) of
         {ok, Socket} ->
-            {ok, {ssl, Socket}};
+            case ssl:ssl_accept(Socket) of
+                ok ->
+                    {ok, {ssl, Socket}};
+                {error, _} = Err ->
+                    Err
+            end;
         {error, _} = Err ->
             Err
     catch
@@ -38,9 +42,6 @@ accept({ssl, ListenSocket}) ->
 accept(ListenSocket) ->
     gen_tcp:accept(ListenSocket, ?ACCEPT_TIMEOUT).
 
-after_accept({ssl, Socket}) -> ssl:ssl_accept(Socket, ?SSL_ACCEPT_TIMEOUT);
-after_accept(_Socket) -> ok.
-
 recv({ssl, Socket}, Length, Timeout) ->
     ssl:recv(Socket, Length, Timeout);
 recv(Socket, Length, Timeout) ->


Mime
View raw message