Explorar o código

Fix a double-counting bug in addrmap_get_virtual_address

We were decrementing "available" twice for each in-use address we ran
across.  This would make us declare that we ran out of virtual
addresses when the address space was only half full.
Nick Mathewson %!s(int64=14) %!d(string=hai) anos
pai
achega
31d6659d97
Modificáronse 2 ficheiros con 5 adicións e 1 borrados
  1. 4 0
      changes/bug2328
  2. 1 1
      src/or/connection_edge.c

+ 4 - 0
changes/bug2328

@@ -0,0 +1,4 @@
+  o Minor bugfixes
+    - Fix a bug where we would declare that we had run out of virtual
+      addresses when the address space was only half-exhausted.  Bugfix
+      on 0.1.1.19-rc.

+ 1 - 1
src/or/connection_edge.c

@@ -1178,7 +1178,7 @@ addressmap_get_virtual_address(int type)
       ++next_virtual_addr;
       ++next_virtual_addr;
       --available;
       --available;
       log_info(LD_CONFIG, "%d addrs available", (int)available);
       log_info(LD_CONFIG, "%d addrs available", (int)available);
-      if (! --available) {
+      if (! available) {
         log_warn(LD_CONFIG, "Ran out of virtual addresses!");
         log_warn(LD_CONFIG, "Ran out of virtual addresses!");
         return NULL;
         return NULL;
       }
       }