*addrs = NULL;
*addr_lens = NULL;
desc = NULL;
- if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "DISABLEV6"))
+ if (GNUNET_CONFIGURATION_have_value (cfg,
+ service_name,
+ "DISABLEV6"))
{
if (GNUNET_SYSERR ==
(disablev6 =
- GNUNET_CONFIGURATION_get_value_yesno (cfg, service_name, "DISABLEV6")))
+ GNUNET_CONFIGURATION_get_value_yesno (cfg,
+ service_name,
+ "DISABLEV6")))
return GNUNET_SYSERR;
}
else
if (! disablev6)
{
/* probe IPv6 support */
- desc = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0);
+ desc = GNUNET_NETWORK_socket_create (PF_INET6,
+ SOCK_STREAM,
+ 0);
if (NULL == desc)
{
- if ((ENOBUFS == errno) || (ENOMEM == errno) || (ENFILE == errno) ||
- (EACCES == errno))
+ if ( (ENOBUFS == errno) ||
+ (ENOMEM == errno) ||
+ (ENFILE == errno) ||
+ (EACCES == errno) )
{
- LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "socket");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
+ "socket");
return GNUNET_SYSERR;
}
LOG (GNUNET_ERROR_TYPE_INFO,
_("Disabling IPv6 support for service `%s', failed to create IPv6 socket: %s\n"),
- service_name, STRERROR (errno));
+ service_name,
+ STRERROR (errno));
disablev6 = GNUNET_YES;
}
else
}
port = 0;
- if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT"))
+ if (GNUNET_CONFIGURATION_have_value (cfg,
+ service_name,
+ "PORT"))
{
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (cfg, service_name,
- "PORT", &port))
+ GNUNET_CONFIGURATION_get_value_number (cfg,
+ service_name,
+ "PORT",
+ &port))
{
LOG (GNUNET_ERROR_TYPE_ERROR,
_("Require valid port number for service `%s' in configuration!\n"),
}
}
- if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "BINDTO"))
+ if (GNUNET_CONFIGURATION_have_value (cfg,
+ service_name,
+ "BINDTO"))
{
GNUNET_break (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_string (cfg, service_name,
- "BINDTO", &hostname));
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ service_name,
+ "BINDTO",
+ &hostname));
}
else
hostname = NULL;
abstract = GNUNET_NO;
#ifdef AF_UNIX
if ((GNUNET_YES ==
- GNUNET_CONFIGURATION_have_value (cfg, service_name, "UNIXPATH")) &&
+ GNUNET_CONFIGURATION_have_value (cfg,
+ service_name,
+ "UNIXPATH")) &&
(GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, "UNIXPATH",
- &unixpath)) &&
+ GNUNET_CONFIGURATION_get_value_filename (cfg,
+ service_name,
+ "UNIXPATH",
+ &unixpath)) &&
(0 < strlen (unixpath)))
{
/* probe UNIX support */
if (strlen (unixpath) >= sizeof (s_un.sun_path))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
- _("UNIXPATH `%s' too long, maximum length is %llu\n"), unixpath,
+ _("UNIXPATH `%s' too long, maximum length is %llu\n"),
+ unixpath,
(unsigned long long) sizeof (s_un.sun_path));
unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath);
LOG (GNUNET_ERROR_TYPE_INFO,
if (GNUNET_SYSERR == abstract)
abstract = GNUNET_NO;
#endif
- if ((GNUNET_YES != abstract)
- && (GNUNET_OK !=
- GNUNET_DISK_directory_create_for_file (unixpath)))
+ if ( (GNUNET_YES != abstract) &&
+ (GNUNET_OK !=
+ GNUNET_DISK_directory_create_for_file (unixpath)) )
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
"mkdir",
unixpath);
desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0);
if (NULL == desc)
{
- if ((ENOBUFS == errno) || (ENOMEM == errno) || (ENFILE == errno) ||
- (EACCES == errno))
+ if ( (ENOBUFS == errno) ||
+ (ENOMEM == errno) ||
+ (ENFILE == errno) ||
+ (EACCES == errno) )
{
LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "socket");
GNUNET_free_non_null (hostname);
}
#endif
- if ((0 == port) && (NULL == unixpath))
+ if ( (0 == port) &&
+ (NULL == unixpath) )
{
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Have neither PORT nor UNIXPATH for service `%s', but one is required\n"),
- service_name);
+ if (GNUNET_YES !=
+ GNUNET_CONFIGURATION_get_value_yesno (cfg,
+ service_name,
+ "AUTOSTART"))
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _("Have neither PORT nor UNIXPATH for service `%s', but one is required\n"),
+ service_name);
GNUNET_free_non_null (hostname);
return GNUNET_SYSERR;
}
if (0 == port)
{
- saddrs = GNUNET_malloc (2 * sizeof (struct sockaddr *));
- saddrlens = GNUNET_malloc (2 * sizeof (socklen_t));
- add_unixpath (saddrs, saddrlens, unixpath, abstract);
+ saddrs = GNUNET_new_array (2,
+ struct sockaddr *);
+ saddrlens = GNUNET_new_array (2,
+ socklen_t);
+ add_unixpath (saddrs,
+ saddrlens,
+ unixpath,
+ abstract);
GNUNET_free_non_null (unixpath);
GNUNET_free_non_null (hostname);
*addrs = saddrs;
if (disablev6)
hints.ai_family = AF_INET;
hints.ai_protocol = IPPROTO_TCP;
- if ((0 != (ret = getaddrinfo (hostname, NULL, &hints, &res))) ||
+ if ((0 != (ret = getaddrinfo (hostname,
+ NULL,
+ &hints,
+ &res))) ||
(NULL == res))
{
LOG (GNUNET_ERROR_TYPE_ERROR,
resi = i;
if (NULL != unixpath)
resi++;
- saddrs = GNUNET_malloc ((resi + 1) * sizeof (struct sockaddr *));
- saddrlens = GNUNET_malloc ((resi + 1) * sizeof (socklen_t));
+ saddrs = GNUNET_new_array (resi + 1,
+ struct sockaddr *);
+ saddrlens = GNUNET_new_array (resi + 1,
+ socklen_t);
i = 0;
if (NULL != unixpath)
{
if (NULL != unixpath)
resi++;
i = 0;
- saddrs = GNUNET_malloc ((resi + 1) * sizeof (struct sockaddr *));
- saddrlens = GNUNET_malloc ((resi + 1) * sizeof (socklen_t));
+ saddrs = GNUNET_new_array (resi + 1,
+ struct sockaddr *);
+ saddrlens = GNUNET_new_array (resi + 1,
+ socklen_t);
if (NULL != unixpath)
{
add_unixpath (saddrs, saddrlens, unixpath, abstract);
resi = 2;
if (NULL != unixpath)
resi++;
- saddrs = GNUNET_malloc ((resi + 1) * sizeof (struct sockaddr *));
- saddrlens = GNUNET_malloc ((resi + 1) * sizeof (socklen_t));
+ saddrs = GNUNET_new_array (resi + 1,
+ struct sockaddr *);
+ saddrlens = GNUNET_new_array (resi + 1,
+ socklen_t);
i = 0;
if (NULL != unixpath)
{
- add_unixpath (saddrs, saddrlens, unixpath, abstract);
+ add_unixpath (saddrs,
+ saddrlens,
+ unixpath,
+ abstract);
i++;
}
saddrlens[i] = sizeof (struct sockaddr_in6);
struct GNUNET_MQ_Envelope *env;
struct GNUNET_ARM_ResultMessage *msg;
+ (void) name;
env = GNUNET_MQ_msg (msg,
GNUNET_MESSAGE_TYPE_ARM_RESULT);
msg->result = htonl (result);
uint16_t size;
const char *servicename;
+ (void) cls;
size = ntohs (amsg->header.size) - sizeof (struct GNUNET_ARM_Message);
servicename = (const char *) &amsg[1];
if ( (0 == size) ||
static void
trigger_shutdown (void *cls)
{
+ (void) cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Triggering shutdown\n");
GNUNET_SCHEDULER_shutdown ();
uint16_t size;
const char *servicename;
+ (void) cls;
size = ntohs (amsg->header.size) - sizeof (struct GNUNET_ARM_Message);
servicename = (const char *) &amsg[1];
if ( (0 == size) ||
struct GNUNET_MQ_Envelope *env;
struct GNUNET_MessageHeader *msg;
+ (void) message;
env = GNUNET_MQ_msg (msg,
GNUNET_MESSAGE_TYPE_ARM_TEST);
GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client),
struct ServiceList *i;
unsigned int res;
- for (res = 0, i = running_head; i; i = i->next, res++)
+ for (res = 0, i = running_head; NULL != i; i = i->next, res++)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"%s\n",
i->name);
struct ServiceList *nxt;
struct ServiceListeningInfo *sli;
+ (void) cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"First shutdown phase\n");
if (NULL != child_restart_task)
struct GNUNET_TIME_Relative lowestRestartDelay;
struct ServiceListeningInfo *sli;
+ (void) cls;
child_restart_task = NULL;
GNUNET_assert (GNUNET_NO == in_shutdown);
lowestRestartDelay = GNUNET_TIME_UNIT_FOREVER_REL;
* Task triggered whenever we receive a SIGCHLD (child
* process died).
*
- * @param cls closure, NULL if we need to self-restart
+ * @param cls closure, NULL
*/
static void
maint_child_death (void *cls)
unsigned long statusCode;
const struct GNUNET_DISK_FileHandle *pr;
+ (void) cls;
pr = GNUNET_DISK_pipe_handle (sigpipe,
GNUNET_DISK_PIPE_END_READ);
child_death_task = NULL;
socklen_t *addr_lens;
int ret;
+ (void) cls;
if (0 == strcasecmp (section,
"arm"))
return;
&addr_lens)))
return;
/* this will free (or capture) addrs[i] */
- for (unsigned int i = 0; i < ret; i++)
+ for (unsigned int i = 0; i < (unsigned int) ret; i++)
create_listen_socket (addrs[i],
addr_lens[i],
sl);
/* All clients are considered to be of the "monitor" kind
* (that is, they don't affect ARM shutdown).
*/
+ (void) cls;
+ (void) mq;
GNUNET_SERVICE_client_mark_monitor (client);
return client;
}
struct GNUNET_SERVICE_Client *client,
void *app_ctx)
{
- struct ServiceList *sl;
-
+ (void) cls;
GNUNET_assert (client == app_ctx);
-
- for (sl = running_head; NULL != sl; sl = sl->next)
+ for (struct ServiceList *sl = running_head; NULL != sl; sl = sl->next)
if (sl->killing_client == client)
sl->killing_client = NULL;
}
{
struct GNUNET_SERVICE_Client *client = cls;
+ (void) message;
/* FIXME: might want to start by letting monitor know about
services that are already running */
/* Removal is handled by the server implementation, internally. */
/**
* Process arm requests.
*
- * @param cls closure
+ * @param cls closure, NULL
* @param serv the initialized service
* @param c configuration to use
*/
{
struct ServiceList *sl;
+ (void) cls;
cfg = c;
service = serv;
GNUNET_SCHEDULER_add_shutdown (&shutdown_task,