mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
fix error path in file transfer
Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
acfa1a879e
commit
5ab9c68687
1 changed files with 4 additions and 5 deletions
|
@ -492,10 +492,8 @@ int libwebsockets_serve_http_file_fragment(struct libwebsocket_context *context,
|
|||
wsi->u.http.filepos += n;
|
||||
}
|
||||
|
||||
if (n < 0) {
|
||||
libwebsocket_close_and_free_session(context, wsi, LWS_CLOSE_STATUS_NOSTATUS);
|
||||
return 1;
|
||||
}
|
||||
if (n < 0)
|
||||
return 1; /* caller will close */
|
||||
|
||||
if (n < sizeof(context->service_buffer) || wsi->u.http.filepos == wsi->u.http.filelen) {
|
||||
wsi->state = WSI_STATE_HTTP;
|
||||
|
@ -503,7 +501,8 @@ int libwebsockets_serve_http_file_fragment(struct libwebsocket_context *context,
|
|||
if (wsi->protocol->callback)
|
||||
ret = user_callback_handle_rxflow(wsi->protocol->callback, context, wsi, LWS_CALLBACK_HTTP_FILE_COMPLETION, wsi->user_space,
|
||||
NULL, 0);
|
||||
return ret;
|
||||
/* user_callback_handle_rxflow did any close already */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue