projects
/
oweals
/
gnunet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6cc6657
)
- Avoid calling shutdown twice
author
Bart Polot
<bart@net.in.tum.de>
Tue, 21 Feb 2012 12:31:01 +0000
(12:31 +0000)
committer
Bart Polot
<bart@net.in.tum.de>
Tue, 21 Feb 2012 12:31:01 +0000
(12:31 +0000)
src/mesh/test_mesh_local_1.c
patch
|
blob
|
history
diff --git
a/src/mesh/test_mesh_local_1.c
b/src/mesh/test_mesh_local_1.c
index 8e1e9b2d0e032d0be489cd6de801e2a05738ba5d..da65b36c4a2fe37916e0796280bd6c5c7c96155a 100644
(file)
--- a/
src/mesh/test_mesh_local_1.c
+++ b/
src/mesh/test_mesh_local_1.c
@@
-42,6
+42,7
@@
static unsigned int two = 2;
static int result;
static GNUNET_SCHEDULER_TaskIdentifier abort_task;
static GNUNET_SCHEDULER_TaskIdentifier test_task;
static int result;
static GNUNET_SCHEDULER_TaskIdentifier abort_task;
static GNUNET_SCHEDULER_TaskIdentifier test_task;
+static GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
/**
/**
@@
-93,6
+94,11
@@
do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
}
result = GNUNET_SYSERR;
abort_task = 0;
}
result = GNUNET_SYSERR;
abort_task = 0;
+ if (GNUNET_SCHEDULER_NO_TASK != shutdown_task)
+ {
+ GNUNET_SCHEDULER_cancel (shutdown_task);
+ shutdown_task = GNUNET_SCHEDULER_NO_TASK;
+ }
do_shutdown (cls, tc);
}
do_shutdown (cls, tc);
}
@@
-116,9
+122,12
@@
data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx,
const struct GNUNET_ATS_Information *atsi)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Data callback\n");
const struct GNUNET_ATS_Information *atsi)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Data callback\n");
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 2), &do_shutdown,
- NULL);
+ if (GNUNET_SCHEDULER_NO_TASK != shutdown_task)
+ GNUNET_SCHEDULER_cancel (shutdown_task);
+ shutdown_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 2), &do_shutdown,
+ NULL);
return GNUNET_OK;
}
return GNUNET_OK;
}
@@
-187,7
+196,10
@@
peer_conected (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_ATS_Information *atsi)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer connected\n");
const struct GNUNET_ATS_Information *atsi)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer connected\n");
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL);
+ if (GNUNET_SCHEDULER_NO_TASK != shutdown_task)
+ GNUNET_SCHEDULER_cancel(shutdown_task);
+ shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+ &do_shutdown, NULL);
}
}