int main(int argc, char *const *argv)
{
int ret;
-
+
+ fprintf (stderr, "mockup starting\n");
ret = (GNUNET_OK ==
GNUNET_SERVICE_run (argc,
argv,
"do-nothing", GNUNET_SERVICE_OPTION_NONE,
&run, NULL)) ? 0 : 1;
+ fprintf (stderr, "mockup stopping\n");
return ret;
}
--- /dev/null
+#! /bin/sh
+
+# mockup_service - temporary wrapper script for .libs/mockup_service
+# Generated by ltmain.sh (GNU libtool) 2.2.6
+#
+# The mockup_service program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='/usr/bin/sed -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=""
+
+# This environment variable determines our operation mode.
+if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
+ # install mode needs the following variables:
+ generated_by_libtool_version='2.2.6'
+ notinst_deplibs=' ../../src/util/libgnunetutil.la'
+else
+ # When we are sourced in execute mode, $file and $ECHO are already set.
+ if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+ ECHO="echo"
+ file="$0"
+ # Make sure echo works.
+ if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
+ # Yippee, $ECHO works!
+ :
+ else
+ # Restart under the correct shell, and then maybe $ECHO will work.
+ exec /bin/sh "$0" --no-reexec ${1+"$@"}
+ fi
+ fi
+
+ # Find the directory that this script lives in.
+ thisdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "x$thisdir" = "x$file" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=`ls -ld "$file" | /usr/bin/sed -n 's/.*-> //p'`
+ while test -n "$file"; do
+ destdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
+
+ # If there was a directory component, then change thisdir.
+ if test "x$destdir" != "x$file"; then
+ case "$destdir" in
+ [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
+ *) thisdir="$thisdir/$destdir" ;;
+ esac
+ fi
+
+ file=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'`
+ file=`ls -ld "$thisdir/$file" | /usr/bin/sed -n 's/.*-> //p'`
+ done
+
+
+ # Usually 'no', except on cygwin/mingw when embedded into
+ # the cwrapper.
+ WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
+ if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then
+ # special case for '.'
+ if test "$thisdir" = "."; then
+ thisdir=`pwd`
+ fi
+ # remove .libs from thisdir
+ case "$thisdir" in
+ *[\\/].libs ) thisdir=`$ECHO "X$thisdir" | $Xsed -e 's%[\\/][^\\/]*$%%'` ;;
+ .libs ) thisdir=. ;;
+ esac
+ fi
+
+ # Try to get the absolute directory name.
+ absdir=`cd "$thisdir" && pwd`
+ test -n "$absdir" && thisdir="$absdir"
+
+ program='mockup_service'
+ progdir="$thisdir/.libs"
+
+
+ if test -f "$progdir/$program"; then
+ # Add our own library path to DYLD_LIBRARY_PATH
+ DYLD_LIBRARY_PATH="/Users/soufi/Career/Munich/TUM/MasterOfScience/Research/GNUnet/EclipseWorkspaceGNUnet/gnunet/src/util/.libs:$DYLD_LIBRARY_PATH"
+
+ # Some systems cannot cope with colon-terminated DYLD_LIBRARY_PATH
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ DYLD_LIBRARY_PATH=`$ECHO "X$DYLD_LIBRARY_PATH" | $Xsed -e 's/::*$//'`
+
+ export DYLD_LIBRARY_PATH
+
+ if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+ # Run the actual program with our arguments.
+
+ exec "$progdir/$program" ${1+"$@"}
+
+ $ECHO "$0: cannot exec $program $*" 1>&2
+ exit 1
+ fi
+ else
+ # The program doesn't exist.
+ $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2
+ $ECHO "This script is just a wrapper for $program." 1>&2
+ echo "See the libtool documentation for more information." 1>&2
+ exit 1
+ fi
+fi
#include "gnunet_configuration_lib.h"
#include "gnunet_program_lib.h"
+#define VERBOSE GNUNET_YES
#define START_ARM GNUNET_YES
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
+#define SERVICE_TEST_TIMEOUT GNUNET_TIME_UNIT_FOREVER_REL
+#define FIVE_MILLISECONDS GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 5)
static struct GNUNET_SCHEDULER_Handle *sched;
static const struct GNUNET_CONFIGURATION_Handle *cfg;
static FILE *killLogFilePtr;
static char *killLogFileName;
+
static void
arm_notify_stop (void *cls, int success)
{
}
+<<<<<<< .mine
+static void
+=======
static void
+>>>>>>> .r10190
do_nothing_notify (void *cls, int success)
{
GNUNET_assert (success == GNUNET_YES);
kill_task (void *cbData,
const struct GNUNET_SCHEDULER_TaskContext *tc);
static void
-do_nothing_restarted_notify_task (void *unused,
+do_nothing_restarted_notify_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
+{
static char a;
static int trialCount = 0;
-
+
trialCount++;
+<<<<<<< .mine
+
+ if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) {
+ fprintf(killLogFilePtr, "%d.Reason is shutdown!\n", trialCount);
+ }
+ else if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) {
+ fprintf(killLogFilePtr, "%d.Reason is timeout!\n", trialCount);
+ }
+ else if ((tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE) != 0) {
+ fprintf(killLogFilePtr, "%d.Service is running!\n", trialCount);
+=======
if (trialCount >= 11) {
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
fprintf(killLogFilePtr, "Reason is shutdown!\n");
fprintf(killLogFilePtr, "%d.Reason is timeout!\n", trialCount);
else if ((tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE) != 0)
fprintf(killLogFilePtr, "%d.Service is running!\n", trialCount);
+>>>>>>> .r10190
}
- GNUNET_SCHEDULER_add_now (sched, &kill_task, &a); // checks if this was too fast
+ GNUNET_SCHEDULER_add_now (sched, &kill_task, &a);
}
kill_task (void *cbData,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- int* reason;
- struct GNUNET_CLIENT_Connection * doNothingConnection = NULL;
+ static struct GNUNET_CLIENT_Connection * doNothingConnection = NULL;
static struct GNUNET_TIME_Absolute startedWaitingAt;
struct GNUNET_TIME_Relative waitedFor;
static int trialCount = 0;
+<<<<<<< .mine
+ if (NULL != cbData) {
+ waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt);
+ fprintf(killLogFilePtr, "Waited for: %lld milliseconds\n\n", waitedFor.value);
+=======
reason = cbData;
if (NULL != reason) {
waitedFor = GNUNET_TIME_absolute_get_duration(startedWaitingAt);
trialCount,
(unsigned long long) startedWaitingAt.value,
(unsigned long long) waitedFor.value);
+>>>>>>> .r10190
}
- /* Connect to the doNothing task */
+ /* Connect to the doNothing task */
doNothingConnection = GNUNET_CLIENT_connect (sched, "do-nothing", cfg);
if (NULL == doNothingConnection)
fprintf(killLogFilePtr, "Unable to connect to do-nothing process!\n");
- else if (trialCount == 20) {
+
+ if (trialCount == 20) {
GNUNET_ARM_stop_service (arm, "do-nothing", TIMEOUT, &arm_notify_stop, NULL);
return;
}
- /* Use the created connection to kill the doNothingTask */
+ /* Use the created connection to kill the doNothingTask */
GNUNET_CLIENT_service_shutdown(doNothingConnection);
- sleep(0.005);
+ trialCount++;
startedWaitingAt = GNUNET_TIME_absolute_get();
- /*
- * There is something wrong here!
- * TIMEOUT value is set to 10 seconds (a drastically large value)
- * debugging is showing that the reason for which
- * do_nothing_restarted_notify_task is called is "always"
- * TIMEOUT which means that the "do-nothing" service is not running
- * however the overall execution time doesn't exceed 2 seconds
- * which means there is something tricky about the TIMOUT passed
- * to function GNUNET_CLIENT_service_test()
- */
- GNUNET_CLIENT_service_test(sched, "do-nothing", cfg, TIMEOUT, &do_nothing_restarted_notify_task, NULL);
+ sleep(1);
+ GNUNET_CLIENT_service_test(sched, "do-nothing", cfg, GNUNET_TIME_UNIT_SECONDS, &do_nothing_restarted_notify_task, NULL);
}
static void
#include "gnunet_server_lib.h"
#include "gnunet_scheduler_lib.h"
-#define DEBUG_CLIENT GNUNET_NO
+#define DEBUG_CLIENT GNUNET_YES
/**
}
conn->test_cb = task;
conn->test_cb_cls = task_cls;
+
+
+ if (NULL == GNUNET_CLIENT_notify_transmit_ready (conn,
+ sizeof (struct GNUNET_MessageHeader),
+ timeout,
+ GNUNET_YES,
+ &write_test, NULL))
+ /*
if (NULL ==
GNUNET_CONNECTION_notify_transmit_ready (conn->sock,
sizeof (struct
GNUNET_MessageHeader),
timeout, &write_test, NULL))
+ */
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Failure to transmit request to service `%s'\n"),
{
struct GNUNET_CLIENT_TransmitHandle *th = cls;
+ fprintf (stderr, "cdr running\n");
th->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
(0 == --th->attempts_left) ||
(delay.value < 1) )
{
+ fprintf (stderr, "Signaling timeout, reason: %d %d %d %d\n",
+ (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & GNUNET_SCHEDULER_get_reason (th->sock->sched))),
+ (GNUNET_YES != th->auto_retry),
+ (0 == --th->attempts_left) ,
+ (delay.value < 1) );
#if DEBUG_CLIENT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmission failed %u times, giving up.\n",
th->sock->ignore_shutdown);
delay = GNUNET_TIME_relative_min (delay, th->sock->back_off);
th->sock->back_off
- = GNUNET_TIME_relative_min (GNUNET_TIME_relative_multiply (th->sock->back_off, 2),
+ = GNUNET_TIME_relative_min (GNUNET_TIME_relative_multiply (th->sock->back_off, 2),
GNUNET_TIME_UNIT_SECONDS);
#if DEBUG_CLIENT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,