diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-07-23 06:40:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:57:42 -0500 |
commit | 5ddf678e0113f81aa2b5f99134cda4fe8c01afb7 (patch) | |
tree | 68e10d04766a1ad8e05f30c4d58e4398343ac7fb /source4/torture | |
parent | 1ce4a2d5fecae297e5b6f6e8f0d68534d9dc7c92 (diff) | |
download | samba-5ddf678e0113f81aa2b5f99134cda4fe8c01afb7.tar.gz samba-5ddf678e0113f81aa2b5f99134cda4fe8c01afb7.tar.bz2 samba-5ddf678e0113f81aa2b5f99134cda4fe8c01afb7.zip |
r1578: the first stage of the async client rewrite.
Up to now the client code has had an async API, and operated
asynchronously at the packet level, but was not truly async in that it
assumed that it could always write to the socket and when a partial
packet came in that it could block waiting for the rest of the packet.
This change makes the SMB client library full async, by adding a
separate outgoing packet queue, using non-blocking socket IO and
having a input buffer that can fill asynchonously until the full
packet has arrived.
The main complexity was in dealing with the events structure when
using the CIFS proxy backend. In that case the same events structure
needs to be used in both the client library and the main smbd server,
so that when the client library is waiting for a reply that the main
server keeps processing packets. This required some changes in the
events library code.
Next step is to make the generated rpc client code use these new
capabilities.
(This used to be commit 96bf4da3edc4d64b0f58ef520269f3b385b8da02)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/basic/scanner.c | 6 | ||||
-rw-r--r-- | source4/torture/gentest.c | 19 |
2 files changed, 8 insertions, 17 deletions
diff --git a/source4/torture/basic/scanner.c b/source4/torture/basic/scanner.c index cf513414e8..20a467100b 100644 --- a/source4/torture/basic/scanner.c +++ b/source4/torture/basic/scanner.c @@ -537,7 +537,8 @@ BOOL torture_smb_scan(int dummy) } usleep(10000); - if (cli_transport_pending(cli->transport)) { + cli_transport_process(cli->transport); + if (req->state > CLI_REQUEST_RECV) { status = cli_request_simple_recv(req); printf("op=0x%x status=%s\n", op, nt_errstr(status)); torture_close_connection(cli); @@ -545,7 +546,8 @@ BOOL torture_smb_scan(int dummy) } sleep(1); - if (cli_transport_pending(cli->transport)) { + cli_transport_process(cli->transport); + if (req->state > CLI_REQUEST_RECV) { status = cli_request_simple_recv(req); printf("op=0x%x status=%s\n", op, nt_errstr(status)); } else { diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 016c19fd5b..e45d9f0124 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -185,7 +185,7 @@ static BOOL connect_servers(void) } cli_oplock_handler(servers[i].cli[j]->transport, oplock_handler, NULL); - cli_transport_idle_handler(servers[i].cli[j]->transport, idle_func, 10, NULL); + cli_transport_idle_handler(servers[i].cli[j]->transport, idle_func, 1, NULL); } } @@ -764,13 +764,8 @@ static void idle_func(struct cli_transport *transport, void *private) for (i=0;i<NSERVERS;i++) { for (j=0;j<NINSTANCES;j++) { if (servers[i].cli[j] && - transport != servers[i].cli[j]->transport && - cli_transport_pending(servers[i].cli[j]->transport)) { - if (!cli_request_receive_next(servers[i].cli[j]->transport)) { - printf("Connection to server %d instance %d died!\n", - i, j); - exit(1); - } + transport != servers[i].cli[j]->transport) { + cli_transport_process(servers[i].cli[j]->transport); } } } @@ -808,13 +803,7 @@ static void check_pending(void) for (j=0;j<NINSTANCES;j++) { for (i=0;i<NSERVERS;i++) { - if (cli_transport_pending(servers[i].cli[j]->transport)) { - if (!cli_request_receive_next(servers[i].cli[j]->transport)) { - printf("Connection to server %d instance %d died!\n", - i, j); - exit(1); - } - } + cli_transport_process(servers[i].cli[j]->transport); } } } |