summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-05-18 20:35:40 +0000
committermidipix <writeonce@midipix.org>2018-05-18 16:45:01 -0400
commit543bf711a91ce96b52b62fc9c0a280a563be903c (patch)
tree1849b15b14d9c2834e23bc216db04bb42f252c03
parent80236ad5d20fbed5fc375d79a7aabcef0137553c (diff)
downloadntapi-543bf711a91ce96b52b62fc9c0a280a563be903c.tar.bz2
ntapi-543bf711a91ce96b52b62fc9c0a280a563be903c.tar.xz
socket interfaces: send and receive: defer wait for completion to caller.
-rw-r--r--src/socket/ntapi_sc_recv.c12
-rw-r--r--src/socket/ntapi_sc_send.c12
2 files changed, 10 insertions, 14 deletions
diff --git a/src/socket/ntapi_sc_recv.c b/src/socket/ntapi_sc_recv.c
index 19a4423..a45eb17 100644
--- a/src/socket/ntapi_sc_recv.c
+++ b/src/socket/ntapi_sc_recv.c
@@ -56,7 +56,7 @@ int32_t __cdecl __ntapi_sc_recv(
afd_recv.afd_recv.afd_flags = (uint32_t)afdflags;
afd_recv.afd_recv.tdi_flags = (uint32_t)tdiflags;
- hssocket->iostatus = __ntapi->zw_device_io_control_file(
+ if ((hssocket->iostatus = __ntapi->zw_device_io_control_file(
hssocket->hsocket,
hssocket->hevent,
0,
@@ -66,13 +66,11 @@ int32_t __cdecl __ntapi_sc_recv(
&afd_recv,
raddr ? sizeof(afd_recv) : sizeof(afd_recv.afd_recv),
0,
- 0);
+ 0)))
+ return hssocket->iostatus;
- if (hssocket->iostatus && (hssocket->ntflags & __NT_FILE_SYNC_IO))
- __ntapi->sc_wait(hssocket,iosb,&hssocket->timeout);
-
- if (!hssocket->iostatus && bytes_received)
+ if (bytes_received)
*bytes_received = iosb->info;
- return hssocket->iostatus;
+ return NT_STATUS_SUCCESS;
}
diff --git a/src/socket/ntapi_sc_send.c b/src/socket/ntapi_sc_send.c
index bf2c0ea..f987cad 100644
--- a/src/socket/ntapi_sc_send.c
+++ b/src/socket/ntapi_sc_send.c
@@ -68,7 +68,7 @@ int32_t __cdecl __ntapi_sc_send(
afd_send.afd_send.afd_flags = (uint32_t)afdflags;
afd_send.afd_send.tdi_flags = (uint32_t)tdiflags;
- hssocket->iostatus = __ntapi->zw_device_io_control_file(
+ if ((hssocket->iostatus = __ntapi->zw_device_io_control_file(
hssocket->hsocket,
hssocket->hevent,
0,
@@ -78,13 +78,11 @@ int32_t __cdecl __ntapi_sc_send(
&afd_send,
addrlen ? sizeof(afd_send) : sizeof(afd_send.afd_send),
0,
- 0);
+ 0)))
+ return hssocket->iostatus;
- if (hssocket->iostatus && (hssocket->ntflags & __NT_FILE_SYNC_IO))
- __ntapi->sc_wait(hssocket,iosb,&hssocket->timeout);
-
- if (!hssocket->iostatus && bytes_sent)
+ if (bytes_sent)
*bytes_sent = iosb->info;
- return hssocket->iostatus;
+ return NT_STATUS_SUCCESS;
}