* C code apparently.
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_program_lib.h"
-#include "gnunet_scheduler_lib.h"
#include "gnunet_transport_service.h"
-#include "transport.h"
#include "transport-testing.h"
-#define START_ARM GNUNET_YES
-
/**
* How long until we give up on transmitting the message?
*/
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90)
/**
* How long until we give up on transmitting the message?
*/
-#define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
+#define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
#define MTYPE 12345
end ()
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
-
if (send_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (send_task);
send_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);
}
+
static void
end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
die_task = GNUNET_SCHEDULER_NO_TASK;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");
-
if (restarted == GNUNET_YES)
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peer was restarted\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peer was restarted, but communication did not resume\n");
if (restarted == GNUNET_NO)
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peer was NOT restarted\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peer was NOT (even) restarted\n");
if (reconnect_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (reconnect_task);
ok = GNUNET_SYSERR;
}
+
static void
reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct PeerContext *p = cls;
reconnect_task = GNUNET_SCHEDULER_NO_TASK;
-
- GNUNET_TRANSPORT_try_connect (p1->th, &p2->id);
+ GNUNET_TRANSPORT_try_connect (p1->th, &p2->id, NULL, NULL); /*FIXME TRY_CONNECT change */
reconnect_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &reconnect, p);
}
+
static void
restart_cb (struct PeerContext *p, void *cls)
{
static int c;
c++;
-
if (c != 2)
return;
-
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Restarted peer %u (`%4s'), issuing reconnect\n", p->no,
GNUNET_i2s (&p->id));
-
reconnect_task = GNUNET_SCHEDULER_add_now (&reconnect, p);
}
+
static void
restart (struct PeerContext *p, char *cfg_file)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Restarting peer %u (`%4s')\n", p->no,
GNUNET_i2s (&p->id));
GNUNET_TRANSPORT_TESTING_restart_peer (tth, p, cfg_file, &restart_cb, p);
- return;
}
+
static void
notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
struct GNUNET_MessageHeader *hdr;
th = NULL;
-
if (buf == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
}
-
static void
start_cb (struct PeerContext *p, void *cls)
{
}
+
static void
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
GNUNET_GETOPT_OPTION_END
};
-#if WRITECONFIG
- setTransportOptions ("test_transport_api_data.conf");
-#endif
send_task = GNUNET_SCHEDULER_NO_TASK;
ok = 1;
GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, test_name,
- "nohelp", options, &run, &ok);
+ "nohelp", options, &run, NULL);
return ok;
}
+
int
main (int argc, char *argv[])
{