View Issue Details

IDProjectCategoryView StatusLast Update
0002607GNUnetutil librarypublic2012-11-05 18:33
Reporterbratao Assigned ToLRN  
PrioritynormalSeveritymajorReproducibilityN/A
Status closedResolutionfixed 
PlatformW32OSWindowsOS Version8
Product VersionGit master 
Target Version0.9.4Fixed in Version0.9.4 
Summary0002607: Optimize GNUNET_NETWORK_fdset_add for W32
DescriptionThis function was responsible for 99% of the CPU usage on W32 (again)
In Winsocks we dont care about nfds, so this code should be similar.

Al the tests are passing.
TagsNo tags attached.
Attached Files
network.c.patch (947 bytes)   
Index: network.c
===================================================================
--- network.c	(revision 24639)
+++ network.c	(working copy)
@@ -896,8 +896,9 @@
 GNUNET_NETWORK_fdset_add (struct GNUNET_NETWORK_FDSet *dst,
                           const struct GNUNET_NETWORK_FDSet *src)
 {
+#ifndef MINGW
   int nfds;
-
+ 
   for (nfds = src->nsds; nfds > 0; nfds--)
     if (FD_ISSET (nfds, &src->sds))
 
@@ -906,7 +907,17 @@
       if (nfds + 1 > dst->nsds)
         dst->nsds = nfds + 1;
     }
-#ifdef MINGW
+#else
+  int i;
+  /* Copy all the writes to the except, so we can detect connect() errors */
+  for (i = 0; i < src->sds.fd_count; i++)
+  {
+      if (src->sds.fd_array[i] != 0 && src->sds.fd_array[i] != -1)
+          FD_SET (src->sds.fd_array[i], &dst->sds);
+          
+      if (src->nsds > dst->nsds)
+          dst->nsds = src->nsds;
+  }
   GNUNET_CONTAINER_slist_append (dst->handles, src->handles);
 #endif
 }
network.c.patch (947 bytes)   

Activities

LRN

2012-11-02 00:40

reporter   ~0006505

Fixed in r24662

Issue History

Date Modified Username Field Change
2012-11-01 17:36 bratao New Issue
2012-11-01 17:36 bratao File Added: network.c.patch
2012-11-02 00:40 LRN Note Added: 0006505
2012-11-02 00:40 LRN Status new => resolved
2012-11-02 00:40 LRN Fixed in Version => Git master
2012-11-02 00:40 LRN Resolution open => fixed
2012-11-02 00:40 LRN Assigned To => LRN
2012-11-05 17:50 Christian Grothoff Fixed in Version Git master => 0.9.4
2012-11-05 17:50 Christian Grothoff Target Version => 0.9.4
2012-11-05 18:33 Christian Grothoff Status resolved => closed