Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Only set the process dictionary if exit was ok

  • Loading branch information...
commit 5a7a1a536f32794910e8730ad93891f23a4e8895 1 parent effae95
Robert Newson authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 apps/couch/src/couch_doc.erl
View
13 apps/couch/src/couch_doc.erl
@@ -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
@@ -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.
Please sign in to comment.
Something went wrong with that request. Please try again.