Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDFS: enable OS controlled server socket size #613

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion master/rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{plists, "",
{git, "https://github.com/discoproject/plists", {branch, "master"}}},
{mochiweb, ".*",
{git, "https://github.com/mochi/mochiweb.git", {tag, "v2.9.2"}}}]}.
{git, "https://github.com/mochi/mochiweb.git", b66b68d95c9e1b2a32b194202e870e6d1e232eb7 }}]}.
{xref_checks,
% Remove 'exports_not_used' from default xref_checks since lager trips it.
[undefined_function_calls]}.
5 changes: 3 additions & 2 deletions master/src/ddfs/ddfs_put.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

% maximum file size: 1T
-define(MAX_RECV_BODY, (1024*1024*1024*1024)).
-define(RECV_CHUNK, (8192)).

-spec start(non_neg_integer()) -> {ok, pid()} | {error, term()}.
start(Port) ->
Expand Down Expand Up @@ -109,13 +110,13 @@ receive_blob(Req, IO, Dst, Url) ->

-spec receive_body(module(), file:io_device()) -> _.
receive_body(Req, IO) ->
R0 = (catch Req:stream_body(?MAX_RECV_BODY,
R0 = (catch Req:stream_body(?RECV_CHUNK,
fun ({BufLen, Buf}, BodyLen) ->
case file:write(IO, Buf) of
ok -> BodyLen + BufLen;
{error, _E} = Err -> throw(Err)
end
end, 0)),
end, 0,?MAX_RECV_BODY)),
case R0 of
% R == <<>> or undefined if body is empty
R when is_integer(R); R =:= <<>>; R =:= undefined ->
Expand Down
3 changes: 2 additions & 1 deletion master/src/ddfs/ddfs_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ start_web(Port, Func, Name) ->
Ret = mochiweb_http:start([{name, Name},
{max, ?HTTP_MAX_CONNS},
{loop, Func},
{port, Port}]),
{port, Port},
{recbuf,undefined}]),
case Ret of
{ok, _Pid} -> error_logger:info_msg("Started ~p at ~p on port ~p",
[Name, node(), Port]);
Expand Down