[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13471 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13471 - gnunet/src/util |
Date: |
Fri, 29 Oct 2010 22:18:06 +0200 |
Author: grothoff
Date: 2010-10-29 22:18:06 +0200 (Fri, 29 Oct 2010)
New Revision: 13471
Modified:
gnunet/src/util/network.c
Log:
w32 patch from LRN
Modified: gnunet/src/util/network.c
===================================================================
--- gnunet/src/util/network.c 2010-10-29 16:12:25 UTC (rev 13470)
+++ gnunet/src/util/network.c 2010-10-29 20:18:06 UTC (rev 13471)
@@ -899,6 +899,7 @@
GNUNET_NETWORK_fdset_overlap (const struct GNUNET_NETWORK_FDSet *fds1,
const struct GNUNET_NETWORK_FDSet *fds2)
{
+#ifndef MINGW
int nfds;
nfds = fds1->nsds;
@@ -910,26 +911,36 @@
if (FD_ISSET (nfds, &fds1->sds) && FD_ISSET (nfds, &fds2->sds))
return GNUNET_YES;
}
-#ifdef MINGW
- {
- struct GNUNET_CONTAINER_SList_Iterator *it;
+#else
+ struct GNUNET_CONTAINER_SList_Iterator *it;
+ HANDLE *h;
+ int i;
+ int j;
- for (it = GNUNET_CONTAINER_slist_begin (fds1->handles);
- GNUNET_CONTAINER_slist_end (it) != GNUNET_YES;
- GNUNET_CONTAINER_slist_next (it))
- {
- HANDLE *h;
+ /*This code is somewhat hacky, we are not supposed to know what's
+ inside of fd_set; also the O(n^2) is really bad... */
- h = (HANDLE *) GNUNET_CONTAINER_slist_get ((const struct
GNUNET_CONTAINER_SList_Iterator *)it, NULL);
- if (GNUNET_CONTAINER_slist_contains
- (fds2->handles, h, sizeof (HANDLE)))
- {
- GNUNET_CONTAINER_slist_iter_destroy (it);
- return GNUNET_YES;
- }
- }
- GNUNET_CONTAINER_slist_iter_destroy (it);
+ for (i = 0; i < fds1->sds.fd_count; i++)
+ {
+ for (j = 0; j < fds2->sds.fd_count; j++)
+ {
+ if (fds1->sds.fd_array[i] == fds2->sds.fd_array[j])
+ return GNUNET_YES;
+ }
}
+ it = GNUNET_CONTAINER_slist_begin (fds1->handles);
+ while (GNUNET_CONTAINER_slist_end (it) != GNUNET_YES)
+ {
+ h = (HANDLE *) GNUNET_CONTAINER_slist_get (it, NULL);
+ if (GNUNET_CONTAINER_slist_contains
+ (fds2->handles, h, sizeof (HANDLE)))
+ {
+ GNUNET_CONTAINER_slist_iter_destroy (it);
+ return GNUNET_YES;
+ }
+ GNUNET_CONTAINER_slist_next (it);
+ }
+ GNUNET_CONTAINER_slist_iter_destroy (it);
#endif
return GNUNET_NO;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13471 - gnunet/src/util,
gnunet <=