Move checking for a closed client out of server_lock_io and into client_serve_request

This commit is contained in:
Alex Young
2012-06-06 13:44:38 +01:00
parent 1b289a0e87
commit 16001eb9eb
3 changed files with 19 additions and 33 deletions

View File

@@ -71,10 +71,7 @@ void* mirror_runner(void* serve_params_uncast)
pthread_mutex_lock(&serve->l_accept),
"Problem with accept lock"
);
SERVER_ERROR_ON_FAILURE(
pthread_mutex_lock(&serve->l_io),
"Problem with I/O lock"
);
server_lock_io( serve );
}
while (current < serve->size) {
@@ -97,11 +94,9 @@ void* mirror_runner(void* serve_params_uncast)
* is likely to slow things down but will be
* safe.
*/
if (pass < last_pass)
SERVER_ERROR_ON_FAILURE(
pthread_mutex_lock(&serve->l_io),
"Problem with I/O lock"
);
if (pass < last_pass) {
server_lock_io( serve );
}
/** FIXME: do something useful with bytes/second */
@@ -117,11 +112,9 @@ void* mirror_runner(void* serve_params_uncast)
/* now mark it clean */
bitset_clear_range(map, current, run);
if (pass < last_pass)
SERVER_ERROR_ON_FAILURE(
pthread_mutex_unlock(&serve->l_io),
"Problem with I/O unlock"
);
if (pass < last_pass) {
server_unlock_io( serve );
}
written += run;
}
@@ -157,10 +150,7 @@ void* mirror_runner(void* serve_params_uncast)
pthread_mutex_unlock(&serve->l_accept),
"Problem with accept unlock"
);
SERVER_ERROR_ON_FAILURE(
pthread_mutex_unlock(&serve->l_io),
"Problem with I/O unlock"
);
server_unlock_io( serve );
return NULL;
}