*/
#define EMPTY_HACK GNUNET_YES
+
+/**
+ * After how long do we retry a service connection that was
+ * unavailable? Used in cases where an exponential back-off
+ * seems inappropriate.
+ */
+#define GNUNET_CONSTANTS_SERVICE_RETRY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500)
+
+/**
+ * How long do we wait after a FORK+EXEC before testing for the
+ * resulting process to be up (port open, waitpid, etc.)?
+ */
+#define GNUNET_CONSTANTS_EXEC_WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 200)
+
/**
* How long do we wait after starting gnunet-service-arm
* for the core service to be alive?
if (NULL == d->hostname)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting `%s', with command `%s %s %s %s'.\n",
+ "Starting local `%s', with command `%s %s %s %s'.\n",
"gnunet-peerinfo", "gnunet-peerinfo", "-c", d->cfgfile,
"-sq");
d->proc_arm_peerinfo =
dst = GNUNET_strdup (d->hostname);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting `%s', with command `%s %s %s %s %s %s'.\n",
+ "Starting remove `%s', with command `%s %s %s %s %s %s'.\n",
"gnunet-peerinfo", "ssh", dst, "gnunet-peerinfo", "-c",
d->cfgfile, "-sq");
if (d->ssh_port_str == NULL)
if (NULL == d->hostname)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting `%s', with command `%s %s %s %s'.\n",
+ "Starting local `%s', with command `%s %s %s %s'.\n",
"gnunet-arm", "gnunet-arm", "-c", d->cfgfile,
"-s");
d->proc_arm_start =
GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm", "-c",
d->cfgfile,
- "-s", "-q", "-T",
- GNUNET_TIME_relative_to_string
- (GNUNET_TIME_absolute_get_remaining
- (d->max_timeout)), NULL);
+ "-s", "-q", "-T", "5 s", NULL);
}
else
{
dst = GNUNET_strdup (d->hostname);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Starting `%s', with command `%s %s %s %s %s %s %s'.\n",
+ "Starting remote `%s', with command `%s %s %s %s %s %s %s'.\n",
"gnunet-arm", "ssh", dst, "gnunet-arm", "-c", d->cfgfile,
"-s", "-q");
if (d->ssh_port_str == NULL)
"-q",
dst, "gnunet-arm",
"-c", d->cfgfile, "-s", "-q", "-T",
- GNUNET_TIME_relative_to_string
+ GNUNET_STRINGS_relative_time_to_string
(GNUNET_TIME_absolute_get_remaining
- (d->max_timeout)), NULL);
+ (d->max_timeout), GNUNET_NO), NULL);
}
else
{
"-q",
dst, "gnunet-arm",
"-c", d->cfgfile, "-s", "-q", "-T",
- GNUNET_TIME_relative_to_string
+ GNUNET_STRINGS_relative_time_to_string
(GNUNET_TIME_absolute_get_remaining
- (d->max_timeout)), NULL);
+ (d->max_timeout), GNUNET_NO), NULL);
}
GNUNET_free (dst);
}
arg, "gnunet-arm",
"-c", d->cfgfile, "-i", service, "-q",
"-T",
- GNUNET_TIME_relative_to_string (timeout),
+ GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO),
NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting gnunet-arm with command ssh %s gnunet-arm -c %s -i %s -q\n",
"Starting gnunet-arm with config `%s' locally.\n", d->cfgfile);
d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
"-c", d->cfgfile, "-i", service, "-q",
- "-T",
- GNUNET_TIME_relative_to_string (timeout),
+ "-T", "5 s",
NULL);
}
arg, "gnunet-arm",
"-c", d->cfgfile, "-i", service, "-q",
"-T",
- GNUNET_TIME_relative_to_string (timeout),
+ GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO),
NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting gnunet-arm with command ssh %s gnunet-arm -c %s -i %s -q -T %s\n",
arg, "gnunet-arm", d->cfgfile, service,
- GNUNET_TIME_relative_to_string (timeout));
+ GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO));
GNUNET_free (arg);
}
else
"Starting gnunet-arm with config `%s' locally.\n", d->cfgfile);
d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
"-c", d->cfgfile, "-i", service, "-q",
- "-T",
- GNUNET_TIME_relative_to_string (timeout),
- NULL);
+ "-T", "5 s", NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting gnunet-arm with command %s -c %s -i %s -q -T %s\n",
- "gnunet-arm", d->cfgfile, service,
- GNUNET_TIME_relative_to_string (timeout));
+ "Starting gnunet-arm with command %s -c %s -i %s -q -T \"5 s\"\n",
+ "gnunet-arm", d->cfgfile, service);
}
d->max_timeout = GNUNET_TIME_relative_to_absolute (timeout);
arg, "gnunet-arm",
"-c", d->cfgfile, "-k", service, "-q",
"-T",
- GNUNET_TIME_relative_to_string (timeout),
+ GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO),
NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Stopping gnunet-arm with command ssh %s gnunet-arm -c %s -k %s -q\n",
d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
"-c", d->cfgfile, "-k", service, "-q",
"-T",
- GNUNET_TIME_relative_to_string (timeout),
+ GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO),
NULL);
}
"-q",
arg, "gnunet-arm",
"-c", d->cfgfile, "-e", "-q", "-T",
- GNUNET_TIME_relative_to_string (timeout),
+ GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO),
del_arg, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Stopping gnunet-arm with command ssh %s gnunet-arm -c %s -e -q %s\n",
"Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile);
d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
"-c", d->cfgfile, "-e", "-q", "-T",
- GNUNET_TIME_relative_to_string (timeout),
+ GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO),
del_arg, NULL);
GNUNET_assert (NULL != d->proc_arm_stop);
}
"Sending connect request to TRANSPORT of %s for peer %s\n",
GNUNET_i2s (&ctx->d1->id),
GNUNET_h2s (&ctx->d2->id.hashPubKey));
- GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id);
+ GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id, NULL, NULL); /*FIXME TRY_CONNECT change */
ctx->timeout_hello =
GNUNET_TIME_relative_add (ctx->timeout_hello,
GNUNET_TIME_relative_multiply
if (connect_ctx->send_hello == GNUNET_NO)
{
- GNUNET_TRANSPORT_try_connect (connect_ctx->d1th, &connect_ctx->d2->id);
+ GNUNET_TRANSPORT_try_connect (connect_ctx->d1th, &connect_ctx->d2->id, NULL, NULL); /*FIXME TRY_CONNECT change */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending connect request to TRANSPORT of %s for peer %s\n",
connect_ctx->d1->shortname, connect_ctx->d2->shortname);
if (NULL == ctx->d2->th)
{
GNUNET_CORE_disconnect (ctx->d1core);
- GNUNET_free (ctx);
if (NULL != ctx->cb)
ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, 0, ctx->d1->cfg,
ctx->d2->cfg, ctx->d1, ctx->d2,
_("Failed to connect to transport service!\n"));
+ GNUNET_free (ctx);
return;
}
ctx->d2->ghh =
if (ctx->d1th == NULL)
{
GNUNET_CORE_disconnect (ctx->d1core);
- GNUNET_free (ctx);
if (NULL != ctx->cb)
ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, 0, ctx->d1->cfg,
ctx->d2->cfg, ctx->d1, ctx->d2,
_("Failed to connect to transport service!\n"));
+ GNUNET_free (ctx);
return;
}
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == ctx->hello_send_task);
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to reconnect %s to %s\n",
ctx->d1->shortname, ctx->d2->shortname);
- GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id);
+ GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id, NULL, NULL); /*FIXME TRY_CONNECT change */
}
ctx->timeout_task =
GNUNET_SCHEDULER_add_delayed (ctx->relative_timeout,