diff options
author | Volker Lendecke <vl@samba.org> | 2008-08-27 19:26:40 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-08-28 18:15:59 +0200 |
commit | bb0fc9cfceab7e961eaa9049d111121609ff8174 (patch) | |
tree | b0c7868eb295412b3b0bbe7f2510dfbdbd74d915 | |
parent | b054f14111337c826548d7728dc2b0a66ab5beae (diff) | |
download | samba-bb0fc9cfceab7e961eaa9049d111121609ff8174.tar.gz samba-bb0fc9cfceab7e961eaa9049d111121609ff8174.tar.bz2 samba-bb0fc9cfceab7e961eaa9049d111121609ff8174.zip |
Add cli_request->recv_helper
Necessary for requests with multiple replies
(This used to be commit cb2e338eb33dfb4627f9b43456af0c86d7d268c6)
-rw-r--r-- | source3/include/async_smb.h | 12 | ||||
-rw-r--r-- | source3/libsmb/async_smb.c | 7 |
2 files changed, 18 insertions, 1 deletions
diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h index 1053de2942..6a09bb6001 100644 --- a/source3/include/async_smb.h +++ b/source3/include/async_smb.h @@ -91,6 +91,18 @@ struct cli_request { uint8_t *rcvbuf; } read; } data; + + /** + * For requests that don't follow the strict request/reply pattern + * such as the transaction request family and echo requests it is + * necessary to break the standard procedure in + * handle_incoming_pdu(). For a simple example look at + * cli_echo_recv_helper(). + */ + struct { + void (*fn)(struct async_req *req); + void *priv; + } recv_helper; }; /* diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index 4d6c32edfa..b5fa9c44b1 100644 --- a/source3/libsmb/async_smb.c +++ b/source3/libsmb/async_smb.c @@ -409,6 +409,7 @@ bool cli_chain_cork(struct cli_state *cli, struct event_context *ev, req->async = NULL; req->enc_state = NULL; + req->recv_helper.fn = NULL; SSVAL(req->outbuf, smb_tid, cli->cnum); cli_setup_packet_buf(cli, req->outbuf); @@ -822,7 +823,11 @@ static void handle_incoming_pdu(struct cli_state *cli) * destructor cli_async_req_destructor(). */ if (req->async[i] != NULL) { - async_req_done(req->async[i]); + if (req->recv_helper.fn != NULL) { + req->recv_helper.fn(req->async[i]); + } else { + async_req_done(req->async[i]); + } } } return; |