* @param tc reason why we are running right now
*/
static void
-process_listen_socket (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+process_listen_socket (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_SERVER_Handle *server = cls;
struct GNUNET_CONNECTION_Handle *sock;
server->listen_sockets[i]);
if (NULL != sock)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Server accepted incoming connection.\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Server accepted incoming connection.\n");
client = GNUNET_SERVER_connect_socket (server, sock);
/* decrement reference count, we don't keep "client" alive */
GNUNET_SERVER_client_drop (client);
* Create and initialize a listen socket for the server.
*
* @param server_addr address to listen on
- * @param socklen length of address
+ * @param socklen length of @a server_addr
* @return NULL on error, otherwise the listen socket
*/
static struct GNUNET_NETWORK_Handle *
(AF_INET == server_addr->sa_family) ? "IPv4" : "IPv6");
else if (AF_UNIX == server_addr->sa_family)
{
- const struct sockaddr_un *un = (const struct sockaddr_un *) server_addr;
- unsigned int off = 0;
-
- if ('\0' == un->sun_path[0])
- off = 1; /* some UNIXPATHs start with 0 */
LOG (GNUNET_ERROR_TYPE_WARNING,
- _("`%s' failed for `%.*s': address already in use\n"), "bind",
- (int) ((sizeof (un->sun_path) - off)),
- (&un->sun_path[off]));
+ _("`%s' failed for `%s': address already in use\n"),
+ "bind",
+ GNUNET_a2s (server_addr, socklen));
}
}
GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
* @param access_cls closure for access
* @param lsocks NULL-terminated array of listen sockets
* @param idle_timeout after how long should we timeout idle connections?
- * @param require_found if YES, connections sending messages of unknown type
+ * @param require_found if #GNUNET_YES, connections sending messages of unknown type
* will be closed
* @return handle for the new server, NULL on error
* (typically, "port" already in use)
{
struct GNUNET_SERVER_Handle *server;
- server = GNUNET_malloc (sizeof (struct GNUNET_SERVER_Handle));
+ server = GNUNET_new (struct GNUNET_SERVER_Handle);
server->idle_timeout = idle_timeout;
server->listen_sockets = lsocks;
server->access = access;
{
struct HandlerList *p;
- p = GNUNET_malloc (sizeof (struct HandlerList));
+ p = GNUNET_new (struct HandlerList);
p->handlers = handlers;
p->next = server->handlers;
server->handlers = p;
(GNUNET_SCHEDULER_NO_TASK == sender->warn_task) )
{
GNUNET_break (0 != type); /* type should never be 0 here, as we don't use 0 */
- sender->warn_start = GNUNET_TIME_absolute_get ();
+ sender->warn_start = GNUNET_TIME_absolute_get ();
sender->warn_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
&warn_no_receive_done, sender);
struct GNUNET_SERVER_Client *client;
struct NotifyList *n;
- client = GNUNET_malloc (sizeof (struct GNUNET_SERVER_Client));
+ client = GNUNET_new (struct GNUNET_SERVER_Client);
client->connection = connection;
client->reference_count = 1;
client->server = server;