aboutsummaryrefslogtreecommitdiff
path: root/src/util/network.c
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2015-01-24 23:01:22 +0000
committerLRN <lrn1986@gmail.com>2015-01-24 23:01:22 +0000
commita1193adca1ddba0f6ac1c58154ae8377225063a3 (patch)
treed2921ab5cb7376337e8a6be82a1d3954d80582a0 /src/util/network.c
parent868ca61cf561f8902b1088710edcc60b96f91df5 (diff)
downloadgnunet-a1193adca1ddba0f6ac1c58154ae8377225063a3.tar.gz
gnunet-a1193adca1ddba0f6ac1c58154ae8377225063a3.zip
Add support for selecting on W32 events
Diffstat (limited to 'src/util/network.c')
-rw-r--r--src/util/network.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/util/network.c b/src/util/network.c
index f2be1aab6..c2ba51d94 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -1725,15 +1725,26 @@ check_handles_status (struct GNUNET_NETWORK_FDSet *fds, int except)
1725 struct GNUNET_DISK_FileHandle *fh; 1725 struct GNUNET_DISK_FileHandle *fh;
1726 unsigned int roff; 1726 unsigned int roff;
1727 unsigned int woff; 1727 unsigned int woff;
1728 int is_pipe;
1729 1728
1730 for (woff = 0, roff = 0; roff < fds->handles_pos; roff++) 1729 for (woff = 0, roff = 0; roff < fds->handles_pos; roff++)
1731 { 1730 {
1732 fh = fds->handles[roff]; 1731 fh = fds->handles[roff];
1733 is_pipe = fh->type == GNUNET_DISK_HANLDE_TYPE_PIPE; 1732 if (fh->type == GNUNET_DISK_HANLDE_TYPE_PIPE)
1734 if ((except && is_pipe && pipe_except_ready (fh)) || 1733 {
1735 (!except && (!is_pipe || pipe_read_ready (fh)))) 1734 if ((except && pipe_except_ready (fh)) ||
1736 fds->handles[woff++] = fh; 1735 (!except && pipe_read_ready (fh)))
1736 fds->handles[woff++] = fh;
1737 }
1738 else if (fh->type == GNUNET_DISK_HANLDE_TYPE_FILE)
1739 {
1740 if (!except)
1741 fds->handles[woff++] = fh;
1742 }
1743 else
1744 {
1745 if (WAIT_OBJECT_0 == WaitForSingleObject (fh, 0))
1746 fds->handles[woff++] = fh;
1747 }
1737 } 1748 }
1738 fds->handles_pos = woff; 1749 fds->handles_pos = woff;
1739 return woff; 1750 return woff;
@@ -1951,6 +1962,11 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
1951 for (i = 0; i <rfds->handles_pos; i++) 1962 for (i = 0; i <rfds->handles_pos; i++)
1952 { 1963 {
1953 fh = rfds->handles[i]; 1964 fh = rfds->handles[i];
1965 if (fh->type == GNUNET_DISK_HANLDE_TYPE_EVENT)
1966 {
1967 handle_array[nhandles++] = fh->h;
1968 continue;
1969 }
1954 if (fh->type != GNUNET_DISK_HANLDE_TYPE_PIPE) 1970 if (fh->type != GNUNET_DISK_HANLDE_TYPE_PIPE)
1955 continue; 1971 continue;
1956 /* Read zero bytes to check the status of the pipe */ 1972 /* Read zero bytes to check the status of the pipe */