Remove the accept lock as being unneeded
This commit is contained in:
@@ -66,11 +66,6 @@ void* mirror_runner(void* serve_params_uncast)
|
||||
debug("mirror start pass=%d", pass);
|
||||
|
||||
if (pass == last_pass) {
|
||||
/* last pass, stop everything else */
|
||||
SERVER_ERROR_ON_FAILURE(
|
||||
pthread_mutex_lock(&serve->l_accept),
|
||||
"Problem with accept lock"
|
||||
);
|
||||
server_lock_io( serve );
|
||||
}
|
||||
|
||||
@@ -146,10 +141,6 @@ void* mirror_runner(void* serve_params_uncast)
|
||||
free(serve->mirror);
|
||||
serve->mirror = NULL; /* and we're gone */
|
||||
|
||||
SERVER_ERROR_ON_FAILURE(
|
||||
pthread_mutex_unlock(&serve->l_accept),
|
||||
"Problem with accept unlock"
|
||||
);
|
||||
server_unlock_io( serve );
|
||||
|
||||
return NULL;
|
||||
|
10
src/serve.c
10
src/serve.c
@@ -284,20 +284,12 @@ void serve_accept_loop(struct server* params)
|
||||
params->control_fd;
|
||||
client_fd = accept(activity_fd, &client_address.generic, &socklen);
|
||||
|
||||
SERVER_ERROR_ON_FAILURE(
|
||||
pthread_mutex_lock(¶ms->l_accept),
|
||||
"Problem with accept lock"
|
||||
);
|
||||
|
||||
if (activity_fd == params->server_fd)
|
||||
accept_nbd_client(params, client_fd, &client_address);
|
||||
if (activity_fd == params->control_fd)
|
||||
accept_control_connection(params, client_fd, &client_address);
|
||||
|
||||
SERVER_ERROR_ON_FAILURE(
|
||||
pthread_mutex_unlock(¶ms->l_accept),
|
||||
"Problem with accept unlock"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +330,6 @@ void serve_cleanup(struct server* params)
|
||||
//free(params->filename);
|
||||
if (params->control_socket_name)
|
||||
//free(params->control_socket_name);
|
||||
pthread_mutex_destroy(¶ms->l_accept);
|
||||
pthread_mutex_destroy(¶ms->l_io);
|
||||
if (params->proxy_fd);
|
||||
close(params->proxy_fd);
|
||||
@@ -363,7 +354,6 @@ void serve_cleanup(struct server* params)
|
||||
/** Full lifecycle of the server */
|
||||
void do_serve(struct server* params)
|
||||
{
|
||||
pthread_mutex_init(¶ms->l_accept, NULL);
|
||||
pthread_mutex_init(¶ms->l_io, NULL);
|
||||
|
||||
params->close_signal = self_pipe_create();
|
||||
|
@@ -56,13 +56,6 @@ struct server {
|
||||
/** size of file */
|
||||
off64_t size;
|
||||
|
||||
/* NB dining philosophers if we ever mave more than one thread
|
||||
* that might need to pause the whole server. At the moment we only
|
||||
* have the one.
|
||||
*/
|
||||
|
||||
/** Claimed around any accept/thread starting loop */
|
||||
pthread_mutex_t l_accept;
|
||||
/** Claims around any I/O to this file */
|
||||
pthread_mutex_t l_io;
|
||||
|
||||
|
Reference in New Issue
Block a user