Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
Only set the process dictionary if exit was ok
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Newson committed Jan 16, 2012
1 parent effae95 commit 5a7a1a5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions apps/couch/src/couch_doc.erl
Expand Up @@ -487,7 +487,8 @@ doc_from_multi_part_stream(ContentType, DataFun) ->
{Parser, ParserRef} = spawn_monitor(fun() ->
{<<"--">>, _, _} = couch_httpd:parse_multipart_request(
ContentType, DataFun,
fun(Next) -> mp_parse_doc(Next, []) end)
fun(Next) -> mp_parse_doc(Next, []) end),
exit(ok)
end),
Parser ! {get_doc_bytes, self()},
receive
Expand All @@ -502,8 +503,14 @@ doc_from_multi_part_stream(ContentType, DataFun) ->
A
end, Doc#doc.atts),
WaitFun = fun() ->
receive {'DOWN', ParserRef, _, _, _} -> ok end,
erlang:put(mochiweb_request_recv, true)
receive {'DOWN', ParserRef, _, _, Result} -> ok end,
case Result of
ok ->
erlang:put(mochiweb_request_recv, true);
_Else ->
?LOG_ERROR("Unexpected msg while parsing multipart stream: ~p",
[Result])
end
end,
{ok, Doc#doc{atts=Atts2}, WaitFun, Parser}
end.
Expand Down

0 comments on commit 5a7a1a5

Please sign in to comment.