couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [04/45] mochiweb commit: updated refs/heads/master to cb521b3
Date Tue, 25 Aug 2015 17:38:22 GMT
Fix the computation of the active_sockets number.

If we added a new socket in the recycle_acceptor, we should not decrement the
number of active sockets.


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

Branch: refs/heads/master
Commit: 18496994430fc8cdec6ad8fdd910e30bb7c1be18
Parents: 3138381
Author: Shayan Pooya <shayan@chango.com>
Authored: Mon Mar 24 11:57:30 2014 -0400
Committer: Shayan Pooya <shayan@chango.com>
Committed: Mon Mar 24 11:59:29 2014 -0400

----------------------------------------------------------------------
 src/mochiweb_socket_server.erl | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/18496994/src/mochiweb_socket_server.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_socket_server.erl b/src/mochiweb_socket_server.erl
index 7d62927..3b7b3da 100644
--- a/src/mochiweb_socket_server.erl
+++ b/src/mochiweb_socket_server.erl
@@ -296,16 +296,16 @@ recycle_acceptor(Pid, State=#mochiweb_socket_server{
                     State#mochiweb_socket_server{acceptor_pool=Pool1}
             end;
         false ->
-            Pool1 =
-                case sets:size(Pool) < PoolSize of
-                    true ->
-                        Acceptor = mochiweb_acceptor:start_link(self(), Listen, Loop),
-                        sets:add_element(Acceptor, Pool);
-                    false ->
-                        Pool
-                end,
-            State#mochiweb_socket_server{active_sockets=ActiveSockets - 1,
-                                         acceptor_pool=Pool1}
+            case sets:size(Pool) < PoolSize of
+                true ->
+                    Acceptor = mochiweb_acceptor:start_link(self(), Listen, Loop),
+                    Pool1 = sets:add_element(Acceptor, Pool),
+                    State#mochiweb_socket_server{active_sockets=ActiveSockets,
+                                                 acceptor_pool=Pool1};
+                false ->
+                    State#mochiweb_socket_server{active_sockets=ActiveSockets - 1,
+                                                 acceptor_pool=Pool}
+            end
     end.
 
 handle_info(Msg, State) when ?is_old_state(State) ->


Mime
View raw message