mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 16:15:57 -05:00
[httpd] Change prototype for the close connection callback
Don't include hreq since it isn't fully valid, so caller shouldn't be invited to dereference it.
This commit is contained in:
parent
18a80f15dd
commit
e94838925e
@ -837,7 +837,7 @@ stream_chunk_raw_cb(int fd, short event, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stream_fail_cb(struct httpd_request *hreq, void *arg)
|
stream_fail_cb(void *arg)
|
||||||
{
|
{
|
||||||
struct stream_ctx *st = arg;
|
struct stream_ctx *st = arg;
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ update_refresh_cb(int fd, short event, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_fail_cb(struct httpd_request *hreq, void *arg)
|
update_fail_cb(void *arg)
|
||||||
{
|
{
|
||||||
struct daap_update_request *ur = arg;
|
struct daap_update_request *ur = arg;
|
||||||
|
|
||||||
|
@ -773,7 +773,7 @@ playstatusupdate_cb(int fd, short what, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_fail_cb(struct httpd_request *hreq, void *arg)
|
update_fail_cb(void *arg)
|
||||||
{
|
{
|
||||||
struct dacp_update_request *ur = arg;
|
struct dacp_update_request *ur = arg;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ typedef struct httpd_backend_data httpd_backend_data;
|
|||||||
|
|
||||||
typedef char *httpd_uri_path_parts[31];
|
typedef char *httpd_uri_path_parts[31];
|
||||||
typedef void (*httpd_request_cb)(struct httpd_request *hreq, void *arg);
|
typedef void (*httpd_request_cb)(struct httpd_request *hreq, void *arg);
|
||||||
typedef void (*httpd_close_cb)(struct httpd_request *hreq, void *arg);
|
typedef void (*httpd_close_cb)(void *arg);
|
||||||
typedef void (*httpd_connection_chunkcb)(httpd_connection *conn, void *arg);
|
typedef void (*httpd_connection_chunkcb)(httpd_connection *conn, void *arg);
|
||||||
typedef void (*httpd_query_iteratecb)(const char *key, const char *val, void *arg);
|
typedef void (*httpd_query_iteratecb)(const char *key, const char *val, void *arg);
|
||||||
|
|
||||||
|
@ -248,6 +248,9 @@ httpd_request_new(httpd_backend *backend, httpd_server *server, const char *uri,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since this is async, libevent will already have closed the connection, so
|
||||||
|
// the parts of hreq that are from httpd_connection will now be invalid e.g.
|
||||||
|
// peer_address.
|
||||||
static void
|
static void
|
||||||
closecb_worker(evutil_socket_t fd, short event, void *arg)
|
closecb_worker(evutil_socket_t fd, short event, void *arg)
|
||||||
{
|
{
|
||||||
@ -257,7 +260,7 @@ closecb_worker(evutil_socket_t fd, short event, void *arg)
|
|||||||
pthread_mutex_lock(&disconnect->lock);
|
pthread_mutex_lock(&disconnect->lock);
|
||||||
|
|
||||||
if (disconnect->cb)
|
if (disconnect->cb)
|
||||||
disconnect->cb(hreq, disconnect->cbarg);
|
disconnect->cb(disconnect->cbarg);
|
||||||
|
|
||||||
pthread_mutex_unlock(&disconnect->lock);
|
pthread_mutex_unlock(&disconnect->lock);
|
||||||
|
|
||||||
@ -289,7 +292,7 @@ closecb_httpd(httpd_connection *conn, void *arg)
|
|||||||
if (!disconnect->cb)
|
if (!disconnect->cb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
disconnect->cb(hreq, disconnect->cbarg);
|
disconnect->cb(disconnect->cbarg);
|
||||||
httpd_send_reply_end(hreq); // hreq is now deallocated
|
httpd_send_reply_end(hreq); // hreq is now deallocated
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ session_new(struct httpd_request *hreq, bool icy_is_requested)
|
|||||||
/* ----------------------------- Event callbacks ---------------------------- */
|
/* ----------------------------- Event callbacks ---------------------------- */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
conn_close_cb(struct httpd_request *hreq, void *arg)
|
conn_close_cb(void *arg)
|
||||||
{
|
{
|
||||||
struct streaming_session *session = arg;
|
struct streaming_session *session = arg;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user