proxy: The minor optimisation bugs if needle is not advanced on iobuf_read()

This commit is contained in:
nick
2013-06-19 11:16:35 +01:00
parent 2156d06368
commit cd0a1f905f

View File

@@ -383,7 +383,6 @@ int proxy_read_from_downstream( struct proxier *proxy, int state )
// assert( state == READ_FROM_DOWNSTREAM ); // assert( state == READ_FROM_DOWNSTREAM );
read:
count = iobuf_read( proxy->downstream_fd, &proxy->req, NBD_REQUEST_SIZE ); count = iobuf_read( proxy->downstream_fd, &proxy->req, NBD_REQUEST_SIZE );
if ( count == -1 ) { if ( count == -1 ) {
@@ -413,11 +412,6 @@ read:
} }
proxy->req.size += request->len; proxy->req.size += request->len;
/* Minor optimisation: Read again immediately if there's write
* request data to be had. No point select()ing again
*/
goto read;
} }
} }
@@ -533,7 +527,6 @@ int proxy_read_from_upstream( struct proxier* proxy, int state )
struct nbd_reply* reply = &(proxy->rsp_hdr); struct nbd_reply* reply = &(proxy->rsp_hdr);
struct nbd_reply_raw* reply_raw = (struct nbd_reply_raw*) proxy->rsp.buf; struct nbd_reply_raw* reply_raw = (struct nbd_reply_raw*) proxy->rsp.buf;
read:
/* We can't assume the NBD_REPLY_SIZE + req->len is what we'll get back */ /* We can't assume the NBD_REPLY_SIZE + req->len is what we'll get back */
count = iobuf_read( proxy->upstream_fd, &proxy->rsp, NBD_REPLY_SIZE ); count = iobuf_read( proxy->upstream_fd, &proxy->rsp, NBD_REPLY_SIZE );
@@ -559,7 +552,6 @@ read:
/* Read the read reply data too. Same optimisation as /* Read the read reply data too. Same optimisation as
* read_from_downstream */ * read_from_downstream */
proxy->rsp.size += proxy->req_hdr.len; proxy->rsp.size += proxy->req_hdr.len;
goto read;
} }
} }