aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed_connectionpool.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-10-28 15:40:59 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-10-28 15:40:59 +0000
commit758409c1bd75091c0c8f783fd613e297be172634 (patch)
tree817216bf85baec7dbf7fc1bae98f019654f74468 /src/testbed/gnunet-service-testbed_connectionpool.c
parent4897dd461e4d8318c87a4c4bc4dc20bfc55b137e (diff)
downloadgnunet-758409c1bd75091c0c8f783fd613e297be172634.tar.gz
gnunet-758409c1bd75091c0c8f783fd613e297be172634.zip
- tolerate zero cache size
Diffstat (limited to 'src/testbed/gnunet-service-testbed_connectionpool.c')
-rw-r--r--src/testbed/gnunet-service-testbed_connectionpool.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c
index 158c9ec3a..ae80c1fd9 100644
--- a/src/testbed/gnunet-service-testbed_connectionpool.c
+++ b/src/testbed/gnunet-service-testbed_connectionpool.c
@@ -286,6 +286,11 @@ destroy_pooled_connection (struct PooledConnection *entry)
286 GNUNET_CONTAINER_multihashmap32_remove (map, 286 GNUNET_CONTAINER_multihashmap32_remove (map,
287 entry->index, 287 entry->index,
288 entry)); 288 entry));
289 if (GNUNET_SCHEDULER_NO_TASK != entry->notify_task)
290 {
291 GNUNET_SCHEDULER_cancel (entry->notify_task);
292 entry->notify_task = GNUNET_SCHEDULER_NO_TASK;
293 }
289 LOG_DEBUG ("Cleaning up handles of a pooled connection\n"); 294 LOG_DEBUG ("Cleaning up handles of a pooled connection\n");
290 if (NULL != entry->handle_transport) 295 if (NULL != entry->handle_transport)
291 GNUNET_assert (NULL != entry->op_transport); 296 GNUNET_assert (NULL != entry->op_transport);
@@ -889,7 +894,9 @@ GST_connection_pool_get_handle_done (struct GST_ConnectionPool_GetHandle *gh)
889 GNUNET_free (gh); 894 GNUNET_free (gh);
890 gh = NULL; 895 gh = NULL;
891 GNUNET_assert (!entry->in_lru); 896 GNUNET_assert (!entry->in_lru);
892 if ( (!entry->in_pool) && (NULL != map) ) 897 if (!entry->in_pool)
898 GNUNET_CONTAINER_DLL_remove (head_not_pooled, tail_not_pooled, entry);
899 if (NULL != map)
893 { 900 {
894 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap32_contains (map, 901 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap32_contains (map,
895 entry->index)) 902 entry->index))
@@ -900,7 +907,6 @@ GST_connection_pool_get_handle_done (struct GST_ConnectionPool_GetHandle *gh)
900 goto unallocate; 907 goto unallocate;
901 destroy_pooled_connection (head_lru); 908 destroy_pooled_connection (head_lru);
902 } 909 }
903 GNUNET_CONTAINER_DLL_remove (head_not_pooled, tail_not_pooled, entry);
904 GNUNET_assert (GNUNET_OK == 910 GNUNET_assert (GNUNET_OK ==
905 GNUNET_CONTAINER_multihashmap32_put (map, 911 GNUNET_CONTAINER_multihashmap32_put (map,
906 entry->index, 912 entry->index,
@@ -908,6 +914,7 @@ GST_connection_pool_get_handle_done (struct GST_ConnectionPool_GetHandle *gh)
908 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 914 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
909 entry->in_pool = GNUNET_YES; 915 entry->in_pool = GNUNET_YES;
910 } 916 }
917
911 unallocate: 918 unallocate:
912 GNUNET_assert (0 < entry->demand); 919 GNUNET_assert (0 < entry->demand);
913 entry->demand--; 920 entry->demand--;