View Issue Details

IDProjectCategoryView StatusLast Update
0002607GNUnetutil librarypublic2012-11-05 17:33
Reporterbratao Assigned ToLRN Due Date
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-01 23:40

reporter   ~0006505

Fixed in r24662

Issue History

Date ModifiedUsernameFieldChange
2012-11-01 16:36brataoNew Issue
2012-11-01 16:36brataoFile Added: network.c.patch
2012-11-01 23:40LRNNote Added: 0006505
2012-11-01 23:40LRNStatusnew => resolved
2012-11-01 23:40LRNFixed in Version => Git master
2012-11-01 23:40LRNResolutionopen => fixed
2012-11-01 23:40LRNAssigned To => LRN
2012-11-05 16:50Christian GrothoffFixed in VersionGit master => 0.9.4
2012-11-05 16:50Christian GrothoffTarget Version => 0.9.4
2012-11-05 17:33Christian GrothoffStatusresolved => closed