Skip to content

Commit

Permalink
Move record declarations to .hrl file.
Browse files Browse the repository at this point in the history
  • Loading branch information
lastres committed Jan 15, 2013
1 parent 4e4bd78 commit 63463fa
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 33 deletions.
36 changes: 36 additions & 0 deletions include/lhttpc.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,39 @@
user = "" :: string(),
password = "" :: string()
}).

%used by lhttpc_manager.
-record(httpc_man, {
destinations = dict:new(),
sockets = dict:new(),
clients = dict:new(), % Pid => {Dest, MonRef}
queues = dict:new(), % Dest => queue of Froms
max_pool_size = 50 :: non_neg_integer(),
timeout = 300000 :: non_neg_integer()
}).

%record that keeps the state of the client.
-record(client_state, {
host :: string(),
port = 80 :: integer(),
ssl = false :: true | false,
method :: string(),
request :: iolist(),
request_headers :: headers(),
socket,
connect_timeout = infinity :: timeout(),
connect_options = [] :: [any()],
attempts :: integer(),
requester :: pid(),
partial_upload = false :: true | false,
chunked_upload = false :: true | false,
upload_window :: non_neg_integer() | infinity,
partial_download = false :: true | false,
download_window = infinity :: timeout(),
part_size :: non_neg_integer() | infinity,
%% in case of infinity we read whatever data we can get from
%% the wire at that point or in case of chunked one chunk
proxy :: undefined | #lhttpc_url{},
proxy_ssl_options = [] :: [any()],
proxy_setup = false :: true | false
}).
26 changes: 1 addition & 25 deletions src/lhttpc_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,10 @@
-include("lhttpc_types.hrl").
-include("lhttpc.hrl").

-record(client_state, {
host :: string(),
port = 80 :: integer(),
ssl = false :: true | false,
method :: string(),
request :: iolist(),
request_headers :: headers(),
socket,
connect_timeout = infinity :: timeout(),
connect_options = [] :: [any()],
attempts :: integer(),
requester :: pid(),
partial_upload = false :: true | false,
chunked_upload = false :: true | false,
upload_window :: non_neg_integer() | infinity,
partial_download = false :: true | false,
download_window = infinity :: timeout(),
part_size :: non_neg_integer() | infinity,
%% in case of infinity we read whatever data we can get from
%% the wire at that point or in case of chunked one chunk
proxy :: undefined | #lhttpc_url{},
proxy_ssl_options = [] :: [any()],
proxy_setup = false :: true | false
}).

-define(CONNECTION_HDR(HDRS, DEFAULT),
string:to_lower(lhttpc_lib:header_value("connection", HDRS, DEFAULT))).


-spec request(pid(), string(), 1..65535, true | false, string(),
string() | atom(), headers(), iolist(), [option()]) -> no_return().
%% @spec (From, Host, Port, Ssl, Path, Method, Hdrs, RequestBody, Options) -> ok
Expand Down
10 changes: 2 additions & 8 deletions src/lhttpc_manager.erl
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,8 @@

-behaviour(gen_server).

-record(httpc_man, {
destinations = dict:new(),
sockets = dict:new(),
clients = dict:new(), % Pid => {Dest, MonRef}
queues = dict:new(), % Dest => queue of Froms
max_pool_size = 50 :: non_neg_integer(),
timeout = 300000 :: non_neg_integer()
}).
-include("lhttpc_types.hrl").
-include("lhttpc.hrl").

%% @spec (PoolPidOrName) -> list()
%% @doc Returns the current settings in state for the
Expand Down

0 comments on commit 63463fa

Please sign in to comment.