mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
server vfs: close: cleanup also at just_kill_connection
Also make sure to close the vfs handle on transaction completed as well as close.
This commit is contained in:
parent
1d3e103c74
commit
285fb9c8ba
4 changed files with 16 additions and 1 deletions
|
@ -202,7 +202,10 @@ lws_vfs_file_open(const struct lws_plat_file_ops *fops, const char *vfs_path,
|
|||
static LWS_INLINE int
|
||||
lws_vfs_file_close(lws_fop_fd_t *fop_fd)
|
||||
{
|
||||
return (*fop_fd)->fops->LWS_FOP_CLOSE(fop_fd);
|
||||
if (*fop_fd && (*fop_fd)->fops)
|
||||
return (*fop_fd)->fops->LWS_FOP_CLOSE(fop_fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -408,6 +408,12 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
|
|||
|
||||
just_kill_connection:
|
||||
|
||||
#if defined(LWS_WITH_FILE_OPS) && (defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2))
|
||||
if (lwsi_role_http(wsi) && lwsi_role_server(wsi) &&
|
||||
wsi->http.fop_fd != NULL)
|
||||
lws_vfs_file_close(&wsi->http.fop_fd);
|
||||
#endif
|
||||
|
||||
#if defined(LWS_WITH_SYS_ASYNC_DNS)
|
||||
lws_async_dns_cancel(wsi);
|
||||
#endif
|
||||
|
|
|
@ -333,6 +333,7 @@ lws_client_connect_3_connect(struct lws *wsi, const char *ads,
|
|||
#if defined(LWS_WITH_UNIX_SOCK)
|
||||
if (ads && *ads == '+') {
|
||||
ads++;
|
||||
memset(&sa46, 0, sizeof(sa46));
|
||||
memset(&sau, 0, sizeof(sau));
|
||||
sau.sun_family = AF_UNIX;
|
||||
strncpy(sau.sun_path, ads, sizeof(sau.sun_path));
|
||||
|
|
|
@ -2253,6 +2253,11 @@ lws_http_transaction_completed(struct lws *wsi)
|
|||
#ifdef LWS_WITH_ACCESS_LOG
|
||||
wsi->http.access_log.sent = 0;
|
||||
#endif
|
||||
#if defined(LWS_WITH_FILE_OPS) && (defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2))
|
||||
if (lwsi_role_http(wsi) && lwsi_role_server(wsi) &&
|
||||
wsi->http.fop_fd != NULL)
|
||||
lws_vfs_file_close(&wsi->http.fop_fd);
|
||||
#endif
|
||||
|
||||
if (wsi->vhost->keepalive_timeout)
|
||||
n = PENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE;
|
||||
|
|
Loading…
Add table
Reference in a new issue