Fix the sense of client_serve_request

This commit is contained in:
Alex Young
2012-06-06 14:25:35 +01:00
parent e8b47d5855
commit cfa9f9c71f
3 changed files with 11 additions and 11 deletions

View File

@@ -294,28 +294,28 @@ void client_reply( struct client* client, struct nbd_request request )
}
/* Returns 0 if a request was successfully served. */
int client_serve_request(struct client* client)
{
struct nbd_request request;
int request_err;
int success = 1;
int failure = 1;
if ( !client_read_request( client, &request ) ) { return success; }
if ( !client_read_request( client, &request ) ) { return failure; }
if ( !client_request_needs_reply( client, request, &request_err ) ) {
return request_err;
}
server_lock_io( client->serve );
if ( server_detect_closed( client->serve ) ) {
success = 0;
} else {
{
if ( !server_is_closed( client->serve ) ) {
client_reply( client, request );
failure = 0;
}
}
server_unlock_io( client->serve );
return success;
return failure;
}

View File

@@ -250,7 +250,7 @@ void accept_nbd_client(
}
int server_detect_closed(struct server* serve)
int server_is_closed(struct server* serve)
{
int errno_old = errno;
int result = fcntl(serve->server_fd, F_GETFD, 0) < 0;

View File

@@ -75,7 +75,7 @@ struct server {
nbd_client[MAX_NBD_CLIENTS];
};
int server_detect_closed(struct server* serve);
int server_is_closed(struct server* serve);
void server_dirty(struct server *serve, off64_t from, int len);
int server_lock_io( struct server * serve);
void server_unlock_io( struct server* serve );