aboutsummaryrefslogtreecommitdiff
path: root/src/lockmanager
diff options
context:
space:
mode:
authorharsha <harsha@140774ce-b5e7-0310-ab8b-a85725594a96>2012-06-20 11:50:31 +0000
committerharsha <harsha@140774ce-b5e7-0310-ab8b-a85725594a96>2012-06-20 11:50:31 +0000
commit616166d0bd06d1842dcf709195efd795355729fb (patch)
treefc21cc28de24e237de5d0fa8bc0af68da65893bf /src/lockmanager
parentc3dd898de5b5095a38cbf15eed0733f6fd06c15a (diff)
-lockmanager acquire retry
git-svn-id: https://gnunet.org/svn/gnunet@22148 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/lockmanager')
-rw-r--r--src/lockmanager/Makefile.am11
-rw-r--r--src/lockmanager/lockmanager_api.c6
-rw-r--r--src/lockmanager/test_lockmanager_api_acquireretry.c10
3 files changed, 16 insertions, 11 deletions
diff --git a/src/lockmanager/Makefile.am b/src/lockmanager/Makefile.am
index 9a672cbef7..d08d02a85b 100644
--- a/src/lockmanager/Makefile.am
+++ b/src/lockmanager/Makefile.am
@@ -41,13 +41,14 @@ libgnunetlockmanager_la_LDFLAGS = \
check_PROGRAMS = \
test_lockmanager_api \
test_lockmanager_api_lockrelease \
- test_lockmanager_api_servercrash
+ test_lockmanager_api_servercrash \
+ test_lockmanager_api_acquireretry
EXTRA_DIST = \
test_lockmanager_api.conf
if ENABLE_TEST_RUN
-TESTS = $(check_PROGRAMS)
+ TESTS = $(check_PROGRAMS)
endif
test_lockmanager_api_SOURCES = \
@@ -67,3 +68,9 @@ test_lockmanager_api_servercrash_SOURCES = \
test_lockmanager_api_servercrash_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
libgnunetlockmanager.la
+
+test_lockmanager_api_acquireretry_SOURCES = \
+ test_lockmanager_api_acquireretry.c
+test_lockmanager_api_acquireretry_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ libgnunetlockmanager.la \ No newline at end of file
diff --git a/src/lockmanager/lockmanager_api.c b/src/lockmanager/lockmanager_api.c
index 07e0220dd3..2d2c75d509 100644
--- a/src/lockmanager/lockmanager_api.c
+++ b/src/lockmanager/lockmanager_api.c
@@ -418,6 +418,8 @@ release_n_retry_iterator (void *cls,
struct GNUNET_LOCKMANAGER_Handle *h = cls;
struct GNUNET_LOCKMANAGER_Message *msg;
+ msg = generate_acquire_msg (r->domain, r->lock);
+ queue_message (h, msg);
if (GNUNET_LOCKMANAGER_RELEASE == r->status)
return GNUNET_YES;
if (NULL != r->status_cb)
@@ -429,10 +431,8 @@ release_n_retry_iterator (void *cls,
r->status_cb (r->status_cb_cls,
r->domain,
r->lock,
- GNUNET_LOCKMANAGER_RELEASE);
+ GNUNET_LOCKMANAGER_RELEASE);
}
- msg = generate_acquire_msg (r->domain, r->lock);
- queue_message (h, msg);
return GNUNET_YES;
}
diff --git a/src/lockmanager/test_lockmanager_api_acquireretry.c b/src/lockmanager/test_lockmanager_api_acquireretry.c
index 6f4f1379ea..a75476442c 100644
--- a/src/lockmanager/test_lockmanager_api_acquireretry.c
+++ b/src/lockmanager/test_lockmanager_api_acquireretry.c
@@ -56,7 +56,7 @@ enum Test
/**
* Client has successfully acquired the lock
*/
- TEST_CLIENT_LOCK_SUCESS,
+ TEST_CLIENT_LOCK_SUCCESS,
/**
* Client has lost the lock
@@ -77,7 +77,7 @@ static struct GNUNET_OS_Process *arm_pid = NULL;
/**
* Configuration Handle
*/
-static struct GNUNET_CONFIGURATION_Handle *config;
+static const struct GNUNET_CONFIGURATION_Handle *config;
/**
* The handle to the lockmanager service
@@ -126,8 +126,6 @@ do_shutdown (void *cls, const const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_OS_process_wait (arm_pid);
GNUNET_OS_process_destroy (arm_pid);
}
- if (NULL != config)
- GNUNET_CONFIGURATION_destroy (config);
}
/**
@@ -195,7 +193,7 @@ status_cb (void *cls,
GNUNET_assert (NULL != arm_pid);
break;
case TEST_CLIENT_LOCK_RELEASE:
- GNUNET_asset (handle == cls);
+ GNUNET_assert (handle == cls);
GNUNET_assert (GNUNET_LOCKMANAGER_SUCCESS == status);
result = TEST_CLIENT_LOCK_AGAIN_SUCCESS;
GNUNET_LOCKMANAGER_cancel_request (request);
@@ -226,7 +224,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
&status_cb,
handle);
GNUNET_assert (NULL != request);
- abort_task_id = GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (10),
+ abort_task_id = GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (30),
&do_abort,
NULL);
}