couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [25/50] git commit: Merge branch 'master' of github.com:cmullaparthi/ibrowse
Date Fri, 17 Jan 2014 22:44:52 GMT
Merge branch 'master' of github.com:cmullaparthi/ibrowse


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

Branch: refs/heads/import
Commit: 1ab803a12fcc8938114b07e01e4f42471064e14a
Parents: d3d43e8 87e8d0c
Author: Chandrashekhar Mullaparthi <chandrashekhar.mullaparthi@gmail.com>
Authored: Mon Jan 23 05:21:11 2012 +0000
Committer: Chandrashekhar Mullaparthi <chandrashekhar.mullaparthi@gmail.com>
Committed: Mon Jan 23 05:21:11 2012 +0000

----------------------------------------------------------------------
 .travis.yml         |   9 +
 CHANGELOG           | 269 ++++++++++++++++++++++++
 CONTRIBUTORS        |  38 ++++
 README              | 531 -----------------------------------------------
 README.md           | 281 +++++++++++++++++++++++++
 src/ibrowse.app.src |   4 +-
 src/ibrowse.erl     |  65 ++++--
 7 files changed, 642 insertions(+), 555 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/blob/1ab803a1/src/ibrowse.erl
----------------------------------------------------------------------
diff --cc src/ibrowse.erl
index f706879,2ab3d3a..7c35042
--- a/src/ibrowse.erl
+++ b/src/ibrowse.erl
@@@ -737,15 -714,37 +723,42 @@@ import_config(Filename) -
              ok
      end.
  
+ apply_config(Terms) ->
+     ets:delete_all_objects(ibrowse_conf),
+     insert_config(Terms).
+ 
+ insert_config(Terms) ->
+     Fun = fun({dest, Host, Port, MaxSess, MaxPipe, Options}) 
+              when is_list(Host), is_integer(Port),
+                   is_integer(MaxSess), MaxSess > 0,
+                   is_integer(MaxPipe), MaxPipe > 0, is_list(Options) ->
+                   I = [{{max_sessions, Host, Port}, MaxSess},
+                        {{max_pipeline_size, Host, Port}, MaxPipe},
+                        {{options, Host, Port}, Options}],
+                   lists:foreach(
+                     fun({X, Y}) ->
+                             ets:insert(ibrowse_conf,
+                                        #ibrowse_conf{key = X, 
+                                                      value = Y})
+                     end, I);
+              ({K, V}) ->
+                   ets:insert(ibrowse_conf,
+                              #ibrowse_conf{key = K,
+                                            value = V});
+              (X) ->
+                   io:format("Skipping unrecognised term: ~p~n", [X])
+           end,
+     lists:foreach(Fun, Terms).
+ 
  %% @doc Internal export
  get_config_value(Key) ->
 -    [#ibrowse_conf{value = V}] = ets:lookup(ibrowse_conf, Key),
 -    V.
 +    try
 +        [#ibrowse_conf{value = V}] = ets:lookup(ibrowse_conf, Key),
 +        V
 +    catch
 +        error:badarg ->
 +            throw({error, ibrowse_not_running})
 +    end.
  
  %% @doc Internal export
  get_config_value(Key, DefVal) ->


Mime
View raw message