schedule->fd_queue =
silc_hash_table_alloc(0, silc_hash_uint, NULL, NULL, NULL,
silc_schedule_fd_destructor, NULL, TRUE);
- if (!schedule->fd_queue)
+ if (!schedule->fd_queue) {
+ silc_free(schedule);
return NULL;
+ }
silc_list_init(schedule->timeout_queue, struct SilcTaskStruct, next);
silc_list_init(schedule->free_tasks, struct SilcTaskStruct, next);
/* Initialize the platform specific scheduler. */
schedule->internal = schedule_ops.init(schedule, app_context);
+ if (!schedule->internal) {
+ silc_hash_table_free(schedule->fd_queue);
+ silc_mutex_free(schedule->lock);
+ silc_free(schedule);
+ return NULL;
+ }
/* Timeout freelist garbage collection */
silc_schedule_task_add_timeout(schedule, silc_schedule_timeout_gc,
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2001 - 2006 Pekka Riikonen
+ Copyright (C) 2001 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* Initializes the platform specific scheduler. This for example initializes
the wakeup mechanism of the scheduler. In multi-threaded environment
the scheduler needs to be wakenup when tasks are added or removed from
- the task queues. Returns context to the platform specific scheduler. */
+ the task queues. Returns context to the platform specific scheduler.
+ If this returns NULL the scheduler initialization will fail. */
void *(*init)(SilcSchedule schedule, void *app_context);
/* Uninitializes the platform specific scheduler context. */
fprintf(fp, "<stacktrace>%s:%d: #blocks=%lu, bytes=%lu\n",
stack->file, stack->line, blocks, bytes);
for (i = 0; i < stack->depth; i++)
- fprintf(fp, "<pc>%p\n", stack->stack[i]);
+ fprintf(fp, "\tpc=%p\n", stack->stack[i]);
}
}
\r
Author: Pekka Riikonen <priikone@silcnet.org>\r
\r
- Copyright (C) 1998 - 2006 Pekka Riikonen\r
+ Copyright (C) 1998 - 2007 Pekka Riikonen\r
\r
This program is free software; you can redistribute it and/or modify\r
it under the terms of the GNU General Public License as published by\r
void *app_context)\r
{\r
/* Nothing to do */\r
- return NULL;\r
+ return (void *)1;\r
}\r
\r
\r
return SILC_FSM_CONTINUE;
}
+ SILC_LOG_DEBUG(("TCP connection established"));
+
/** Connection created */
silc_fsm_next(fsm, silc_net_connect_st_stream);
SILC_FSM_CALL((conn->sop = silc_socket_tcp_stream_create(
#if defined(HAVE_EPOLL_WAIT)
internal->epfd = epoll_create(4);
- if (internal->epfd < 0)
+ if (internal->epfd < 0) {
+ SILC_LOG_ERROR(("epoll_create() failed: %s", strerror(errno)));
return NULL;
+ }
internal->fds = silc_calloc(4, sizeof(*internal->fds));
if (!internal->fds) {
close(internal->epfd);
return (void *)wakeup;
#else
- return NULL;
+ return (void *)1;
#endif
}