svn commit: samba r4765 - in branches/SAMBA_4_0/source/libcli/raw: .
tridge at samba.org
tridge at samba.org
Sun Jan 16 01:21:18 GMT 2005
Author: tridge
Date: 2005-01-16 01:21:18 +0000 (Sun, 16 Jan 2005)
New Revision: 4765
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4765
Log:
simplify the async socket code to always go via the event handler
rather than short-circuiting in the unlikely event the OS returns an
immediate success on a non-blocking connect
Modified:
branches/SAMBA_4_0/source/libcli/raw/clisocket.c
Changeset:
Modified: branches/SAMBA_4_0/source/libcli/raw/clisocket.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clisocket.c 2005-01-16 01:19:46 UTC (rev 4764)
+++ branches/SAMBA_4_0/source/libcli/raw/clisocket.c 2005-01-16 01:21:18 UTC (rev 4765)
@@ -85,17 +85,11 @@
c->status = smbcli_sock_connect_one(conn->sock,
conn->dest_host,
conn->iports[i]);
- if (NT_STATUS_EQUAL(c->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+ if (NT_STATUS_IS_OK(c->status) ||
+ NT_STATUS_EQUAL(c->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
conn->sock->event.fde->private = c;
return;
}
- if (NT_STATUS_IS_OK(c->status)) {
- c->state = SMBCLI_REQUEST_DONE;
- if (c->async.fn) {
- c->async.fn(c);
- }
- return;
- }
}
c->state = SMBCLI_REQUEST_ERROR;
@@ -153,7 +147,7 @@
this is the async send side of the interface
*/
struct smbcli_composite *smbcli_sock_connect_send(struct smbcli_socket *sock,
- struct ipv4_addr *ip, int port)
+ const char *host_addr, int port)
{
struct smbcli_composite *c;
struct clisocket_connect *conn;
@@ -186,7 +180,7 @@
conn->iports[1] = 0;
}
- conn->dest_host = talloc_strdup(c, sys_inet_ntoa(*ip));
+ conn->dest_host = talloc_strdup(c, host_addr);
if (conn->dest_host == NULL) goto failed;
c->private = conn;
@@ -200,14 +194,11 @@
c->status = smbcli_sock_connect_one(sock,
conn->dest_host,
conn->iports[i]);
- if (NT_STATUS_EQUAL(c->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+ if (NT_STATUS_IS_OK(c->status) ||
+ NT_STATUS_EQUAL(c->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
sock->event.fde->private = c;
return c;
}
- if (NT_STATUS_IS_OK(c->status)) {
- c->state = SMBCLI_REQUEST_DONE;
- return c;
- }
}
c->state = SMBCLI_REQUEST_ERROR;
@@ -235,11 +226,11 @@
sync version of the function
*/
-NTSTATUS smbcli_sock_connect(struct smbcli_socket *sock, struct ipv4_addr *ip, int port)
+NTSTATUS smbcli_sock_connect(struct smbcli_socket *sock, const char *host_addr, int port)
{
struct smbcli_composite *c;
- c = smbcli_sock_connect_send(sock, ip, port);
+ c = smbcli_sock_connect_send(sock, host_addr, port);
if (c == NULL) {
return NT_STATUS_NO_MEMORY;
}
@@ -339,7 +330,7 @@
sock->hostname = name;
- status = smbcli_sock_connect(sock, &ip, port);
+ status = smbcli_sock_connect(sock, sys_inet_ntoa(ip), port);
return NT_STATUS_IS_OK(status);
}
More information about the samba-cvs
mailing list