mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
r1516: remove the server_connection from the list on the server_socket
and call talloc_destroy(srv_conn->mem_ctx)
also don't follow NULL pointers
metze
(This used to be commit 786c00c3d4
)
This commit is contained in:
parent
b11e1a41d8
commit
7a0e61f38e
@ -68,8 +68,18 @@ static void single_accept_connection(struct event_context *ev, struct fd_event *
|
||||
static void single_terminate_connection(struct server_connection *conn, const char *reason)
|
||||
{
|
||||
DEBUG(0,("single_terminate_connection: reason[%s]\n",reason));
|
||||
conn->service->ops->close_connection(conn,reason);
|
||||
server_destroy_connection(conn);
|
||||
|
||||
if (conn) {
|
||||
if (conn->service) {
|
||||
conn->service->ops->close_connection(conn,reason);
|
||||
}
|
||||
|
||||
if (conn->server_socket) {
|
||||
DLIST_REMOVE(conn->server_socket->connection_list,conn);
|
||||
}
|
||||
|
||||
server_destroy_connection(conn);
|
||||
}
|
||||
}
|
||||
|
||||
static int single_get_id(struct smbsrv_request *req)
|
||||
|
@ -91,8 +91,19 @@ static void standard_accept_connection(struct event_context *ev, struct fd_event
|
||||
static void standard_terminate_connection(struct server_connection *conn, const char *reason)
|
||||
{
|
||||
DEBUG(0,("single_terminate_connection: reason[%s]\n",reason));
|
||||
conn->service->ops->close_connection(conn,reason);
|
||||
server_destroy_connection(conn);
|
||||
|
||||
if (conn) {
|
||||
if (conn->service) {
|
||||
conn->service->ops->close_connection(conn,reason);
|
||||
}
|
||||
|
||||
if (conn->server_socket) {
|
||||
DLIST_REMOVE(conn->server_socket->connection_list,conn);
|
||||
}
|
||||
|
||||
server_destroy_connection(conn);
|
||||
}
|
||||
|
||||
/* terminate this process */
|
||||
exit(0);
|
||||
}
|
||||
|
@ -108,8 +108,21 @@ static void thread_accept_connection(struct event_context *ev, struct fd_event *
|
||||
static void thread_terminate_connection(struct server_connection *conn, const char *reason)
|
||||
{
|
||||
DEBUG(0,("thread_terminate_connection: reason[%s]\n",reason));
|
||||
conn->service->ops->close_connection(conn,reason);
|
||||
server_destroy_connection(conn);
|
||||
|
||||
if (conn) {
|
||||
if (conn->service) {
|
||||
conn->service->ops->close_connection(conn,reason);
|
||||
}
|
||||
|
||||
if (conn->server_socket) {
|
||||
MUTEX_LOCK_BY_ID(MUTEX_SMBD);
|
||||
DLIST_REMOVE(conn->server_socket->connection_list,conn);
|
||||
MUTEX_UNLOCK_BY_ID(MUTEX_SMBD);
|
||||
}
|
||||
|
||||
server_destroy_connection(conn);
|
||||
}
|
||||
|
||||
/* terminate this thread */
|
||||
pthread_exit(NULL); /* thread cleanup routine will do actual cleanup */
|
||||
}
|
||||
|
@ -247,8 +247,11 @@ void server_terminate_connection(struct server_connection *srv_conn, const char
|
||||
void server_destroy_connection(struct server_connection *srv_conn)
|
||||
{
|
||||
close(srv_conn->event.fde->fd);
|
||||
|
||||
event_remove_fd(srv_conn->event.ctx, srv_conn->event.fde);
|
||||
event_remove_timed(srv_conn->event.ctx, srv_conn->event.idle);
|
||||
|
||||
talloc_destroy(srv_conn->mem_ctx);
|
||||
}
|
||||
|
||||
void server_io_handler(struct event_context *ev, struct fd_event *fde, time_t t, uint16_t flags)
|
||||
|
Loading…
Reference in New Issue
Block a user