Browse Source

Merge branch 'patch-1' of https://github.com/si14/cowboy

Loïc Hoguin 13 years ago
parent
commit
7b2793b344
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/cowboy_http_static.erl

+ 4 - 2
src/cowboy_http_static.erl

@@ -316,8 +316,10 @@ sfallback(Transport, Socket, File, Sent) ->
 			ok = file:close(File),
 			{sent, Sent};
 		{ok, Bin} ->
-			ok = Transport:send(Socket, Bin),
-			sfallback(Transport, Socket, File, Sent + byte_size(Bin))
+			case Transport:send(Socket, Bin) of
+				ok -> sfallback(Transport, Socket, File, Sent + byte_size(Bin));
+				{error, closed} -> {sent, Sent}
+			end
 	end.