Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add dump_state and dump_acceptors calls to socket server for debugging

  • Loading branch information...
commit 6c5617f11ce34f1c673a4423c160dcda673514ae 1 parent 6218608
@RJ authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/mochiweb_socket_server.erl
View
10 src/mochiweb_socket_server.erl
@@ -9,6 +9,7 @@
-include("internal.hrl").
+-export([dump_state/1, dump_acceptors/1]).
-export([start/1, stop/1]).
-export([init/1, handle_call/3, handle_cast/2, terminate/2, code_change/3,
handle_info/2]).
@@ -38,6 +39,11 @@ start(State=#mochiweb_socket_server{}) ->
start(Options) ->
start(parse_options(Options)).
+dump_acceptors(Pid) ->
+ gen_server:call(Pid, dump_acceptors).
+dump_state(Pid) ->
+ gen_server:call(Pid, dump_state).
+
get(Name, Property) ->
gen_server:call(Name, {get, Property}).
@@ -237,6 +243,10 @@ upgrade_state({mochiweb_socket_server, Port, Loop, Name,
handle_call(Req, From, State) when ?is_old_state(State) ->
handle_call(Req, From, upgrade_state(State));
+handle_call(dump_acceptors,_From, State) ->
+ {reply, State#mochiweb_socket_server.acceptor_pool, State};
+handle_call(dump_state, _From, State) ->
+ {reply, State, State};
handle_call({get, Property}, _From, State) ->
Res = do_get(Property, State),
{reply, Res, State};
Please sign in to comment.
Something went wrong with that request. Please try again.