diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-08 17:06:49 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-08 17:06:49 +0000 |
commit | d336aef5c16128f72d4d6e226148e2520841049f (patch) | |
tree | 22dc982b681a412bd7d719ffe8d9fb475a350ea5 /src/testbed/testbed_api_peers.c | |
parent | a61c2d6c9375867837816f62ca13c474026fd2f1 (diff) | |
download | gnunet-d336aef5c16128f72d4d6e226148e2520841049f.tar.gz gnunet-d336aef5c16128f72d4d6e226148e2520841049f.zip |
- cleanup peers after shutdown operation
Diffstat (limited to 'src/testbed/testbed_api_peers.c')
-rw-r--r-- | src/testbed/testbed_api_peers.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c index 39e4b596a..9ad8366f2 100644 --- a/src/testbed/testbed_api_peers.c +++ b/src/testbed/testbed_api_peers.c | |||
@@ -33,6 +33,59 @@ | |||
33 | #include "testbed_api_hosts.h" | 33 | #include "testbed_api_hosts.h" |
34 | #include "testbed_api_operations.h" | 34 | #include "testbed_api_operations.h" |
35 | 35 | ||
36 | |||
37 | /** | ||
38 | * Peer list DLL head | ||
39 | */ | ||
40 | static struct GNUNET_TESTBED_Peer *peer_list_head; | ||
41 | |||
42 | /** | ||
43 | * Peer list DLL tail | ||
44 | */ | ||
45 | static struct GNUNET_TESTBED_Peer *peer_list_tail; | ||
46 | |||
47 | |||
48 | /** | ||
49 | * Adds a peer to the peer list | ||
50 | * | ||
51 | * @param peer the peer to add to the peer list | ||
52 | */ | ||
53 | void | ||
54 | GNUNET_TESTBED_peer_register_ (struct GNUNET_TESTBED_Peer *peer) | ||
55 | { | ||
56 | GNUNET_CONTAINER_DLL_insert_tail (peer_list_head, peer_list_tail, peer); | ||
57 | } | ||
58 | |||
59 | |||
60 | /** | ||
61 | * Removes a peer from the peer list | ||
62 | * | ||
63 | * @param peer the peer to remove | ||
64 | */ | ||
65 | void | ||
66 | GNUNET_TESTBED_peer_deregister_ (struct GNUNET_TESTBED_Peer *peer) | ||
67 | { | ||
68 | GNUNET_CONTAINER_DLL_remove (peer_list_head, peer_list_tail, peer); | ||
69 | } | ||
70 | |||
71 | |||
72 | /** | ||
73 | * Frees all peers | ||
74 | */ | ||
75 | void | ||
76 | GNUNET_TESTBED_cleanup_peers_ (void) | ||
77 | { | ||
78 | struct GNUNET_TESTBED_Peer *peer; | ||
79 | |||
80 | while (NULL != (peer = peer_list_head)) | ||
81 | { | ||
82 | GNUNET_TESTBED_peer_deregister_ (peer); | ||
83 | GNUNET_free (peer); | ||
84 | } | ||
85 | } | ||
86 | |||
87 | |||
88 | |||
36 | /** | 89 | /** |
37 | * Function to call to start a peer_create type operation once all | 90 | * Function to call to start a peer_create type operation once all |
38 | * queues the operation is part of declare that the | 91 | * queues the operation is part of declare that the |