diff options
-rw-r--r-- | src/cowboy_http_static.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cowboy_http_static.erl b/src/cowboy_http_static.erl index 007cd16..8b9f558 100644 --- a/src/cowboy_http_static.erl +++ b/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. |