diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-06-22 00:42:53 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-06-22 00:42:53 +0000 |
commit | 6fdffd9b6c6150793d86114f18c2239a53625e73 (patch) | |
tree | b285f90a85a5947f59e7e5fba0dd1b38b1e73ebe /source3/libsmb | |
parent | 2e20f1147c70a86b1583613ac99fdb01af042256 (diff) | |
download | samba-6fdffd9b6c6150793d86114f18c2239a53625e73.tar.gz samba-6fdffd9b6c6150793d86114f18c2239a53625e73.tar.xz samba-6fdffd9b6c6150793d86114f18c2239a53625e73.zip |
added some comments to make the cli read code clearer
(This used to be commit bbfbe03cc6166c23c42a704b5acaa19cbdbc39ce)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clireadwrite.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 9ee63270dff..70266a2d9a8 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -55,8 +55,6 @@ size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t { char *p; int total = -1; - int issued=0; - int received=0; /* * There is a problem in this code when mpx is more than one. * for some reason files can get corrupted when being read. @@ -68,12 +66,24 @@ size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t #else int mpx = 1; #endif - int block = (cli->max_xmit - (smb_size+32)) & ~1023; + int block; int mid; - int blocks = (size + (block-1)) / block; + int blocks; + /* issued is the number of readX requests we have sent so far */ + int issued=0; + /* received is the number of readX replies we have received */ + int received=0; + /* maybe its a very silly request? */ if (size == 0) return 0; + /* set block to the maximum size we can handle in one readX, + rounded down to a multiple of 1024 */ + block = (cli->max_xmit - (smb_size+32)) & ~1023; + + /* work out how many readX calls we will need in total */ + blocks = (size + (block-1)) / block; + while (received < blocks) { int size2; |