svn commit: samba r4938 - in branches/SAMBA_4_0/source: libcli libcli/composite libcli/raw torture/rpc

tridge at samba.org tridge at samba.org
Sun Jan 23 09:01:46 GMT 2005


Author: tridge
Date: 2005-01-23 09:01:46 +0000 (Sun, 23 Jan 2005)
New Revision: 4938

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4938

Log:
allow the caller to supply an existing event_context if they want to
in smb_composite_connect_send(). This makes doing parallel calls much
easier.

Modified:
   branches/SAMBA_4_0/source/libcli/cliconnect.c
   branches/SAMBA_4_0/source/libcli/composite/connect.c
   branches/SAMBA_4_0/source/libcli/raw/clisocket.c
   branches/SAMBA_4_0/source/torture/rpc/xplogin.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/cliconnect.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/cliconnect.c	2005-01-23 08:19:38 UTC (rev 4937)
+++ branches/SAMBA_4_0/source/libcli/cliconnect.c	2005-01-23 09:01:46 UTC (rev 4938)
@@ -32,7 +32,7 @@
 {
 	struct smbcli_socket *sock;
 
-	sock = smbcli_sock_init(cli);
+	sock = smbcli_sock_init(cli, NULL);
 	if (!sock) return False;
 
 	if (!smbcli_sock_connect_byname(sock, server, 0)) {

Modified: branches/SAMBA_4_0/source/libcli/composite/connect.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/composite/connect.c	2005-01-23 08:19:38 UTC (rev 4937)
+++ branches/SAMBA_4_0/source/libcli/composite/connect.c	2005-01-23 09:01:46 UTC (rev 4938)
@@ -330,7 +330,8 @@
 /*
   a function to establish a smbcli_tree from scratch
 */
-struct smbcli_composite *smb_composite_connect_send(struct smb_composite_connect *io)
+struct smbcli_composite *smb_composite_connect_send(struct smb_composite_connect *io,
+						    struct event_context *event_ctx)
 {
 	struct smbcli_composite *c;
 	struct connect_state *state;
@@ -342,14 +343,14 @@
 	state = talloc(c, struct connect_state);
 	if (state == NULL) goto failed;
 
-	state->sock = smbcli_sock_init(state);
+	state->sock = smbcli_sock_init(state, event_ctx);
 	if (state->sock == NULL) goto failed;
 
 	state->io = io;
 	state->stage = CONNECT_RESOLVE;
 
 	c->state = SMBCLI_REQUEST_SEND;
-	c->event_ctx = state->sock->event.ctx;
+	c->event_ctx = talloc_reference(c, state->sock->event.ctx);
 	c->private = state;
 
 	name.name = io->in.dest_host;
@@ -391,6 +392,6 @@
 */
 NTSTATUS smb_composite_connect(struct smb_composite_connect *io, TALLOC_CTX *mem_ctx)
 {
-	struct smbcli_composite *c = smb_composite_connect_send(io);
+	struct smbcli_composite *c = smb_composite_connect_send(io, NULL);
 	return smb_composite_connect_recv(c, mem_ctx);
 }

Modified: branches/SAMBA_4_0/source/libcli/raw/clisocket.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clisocket.c	2005-01-23 08:19:38 UTC (rev 4937)
+++ branches/SAMBA_4_0/source/libcli/raw/clisocket.c	2005-01-23 09:01:46 UTC (rev 4938)
@@ -49,8 +49,10 @@
 
 /*
   create a smbcli_socket context
+  The event_ctx is optional - if not supplied one will be created
 */
-struct smbcli_socket *smbcli_sock_init(TALLOC_CTX *mem_ctx)
+struct smbcli_socket *smbcli_sock_init(TALLOC_CTX *mem_ctx, 
+				       struct event_context *event_ctx)
 {
 	struct smbcli_socket *sock;
 
@@ -59,7 +61,11 @@
 		return NULL;
 	}
 
-	sock->event.ctx = event_context_init(sock);
+	if (event_ctx) {
+		sock->event.ctx = talloc_reference(sock, event_ctx);
+	} else {
+		sock->event.ctx = event_context_init(sock);
+	}
 	if (sock->event.ctx == NULL) {
 		talloc_free(sock);
 		return NULL;

Modified: branches/SAMBA_4_0/source/torture/rpc/xplogin.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/xplogin.c	2005-01-23 08:19:38 UTC (rev 4937)
+++ branches/SAMBA_4_0/source/torture/rpc/xplogin.c	2005-01-23 09:01:46 UTC (rev 4938)
@@ -43,7 +43,7 @@
 	struct smbcli_transport *transport;
 	NTSTATUS status;
 
-	sock = smbcli_sock_init(NULL);
+	sock = smbcli_sock_init(NULL, NULL);
 	if (sock == NULL)
 		return NT_STATUS_NO_MEMORY;
 



More information about the samba-cvs mailing list