diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-07-09 10:13:15 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-07-09 13:55:04 +0200 |
commit | 244c856cbfee2d08c0d47241daa7adb6a32f5f24 (patch) | |
tree | 048f56233f12a532fa749cd7e33e6280ef81b7ea /source3/libsmb | |
parent | 8b4a3681e511adafe0efea3d64bad5135867477c (diff) | |
download | samba-244c856cbfee2d08c0d47241daa7adb6a32f5f24.tar.gz samba-244c856cbfee2d08c0d47241daa7adb6a32f5f24.tar.bz2 samba-244c856cbfee2d08c0d47241daa7adb6a32f5f24.zip |
s3:smb2cli_base: ask for the next response if there're still pending requests
metze
Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Sat Jul 9 13:55:04 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/smb2cli_base.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/source3/libsmb/smb2cli_base.c b/source3/libsmb/smb2cli_base.c index ac7d423b57..8760c30b84 100644 --- a/source3/libsmb/smb2cli_base.c +++ b/source3/libsmb/smb2cli_base.c @@ -474,12 +474,14 @@ static void smb2cli_inbuf_received(struct tevent_req *subreq) struct cli_state); TALLOC_CTX *frame = talloc_stackframe(); struct tevent_req *req; + struct smb2cli_req_state *state; struct iovec *iov; int i, num_iov; NTSTATUS status; uint8_t *inbuf; ssize_t received; int err; + size_t num_pending; received = read_smb_recv(subreq, frame, &inbuf, &err); TALLOC_FREE(subreq); @@ -512,7 +514,6 @@ static void smb2cli_inbuf_received(struct tevent_req *subreq) uint8_t *inbuf_ref = NULL; struct iovec *cur = &iov[i]; uint8_t *inhdr = (uint8_t *)cur[0].iov_base; - struct smb2cli_req_state *state; req = cli_smb2_find_pending( cli, BVAL(inhdr, SMB2_HDR_MESSAGE_ID)); @@ -556,6 +557,25 @@ static void smb2cli_inbuf_received(struct tevent_req *subreq) } TALLOC_FREE(frame); + + num_pending = talloc_array_length(cli->pending); + if (num_pending == 0) { + /* no more pending requests, so we are done for now */ + return; + } + req = cli->pending[0]; + state = tevent_req_data(req, struct smb2cli_req_state); + + /* + * add the read_smb request that waits for the + * next answer from the server + */ + subreq = read_smb_send(cli->pending, state->ev, cli->fd); + if (subreq == NULL) { + smb2cli_notify_pending(cli, NT_STATUS_NO_MEMORY); + return; + } + tevent_req_set_callback(subreq, smb2cli_inbuf_received, cli); } NTSTATUS smb2cli_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, |