Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2006 - 2007 Pekka Riikonen
+ Copyright (C) 2006 - 2008 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
*/
-#include "silc.h"
+#include "silcruntime.h"
#include "silcsymbiansocketstream.h"
/************************ Static utility functions **************************/
SILC_LOG_DEBUG(("Creating TCP listener"));
- if (port < 0 || !schedule || !callback)
+ if (!schedule) {
+ schedule = silc_schedule_get_global();
+ if (!schedule) {
+ silc_set_errno(SILC_ERR_INVALID_ARGUMENT);
+ goto err;
+ }
+ }
+
+ if (port < 0 || !callback) {
+ silc_set_errno(SILC_ERR_INVALID_ARGUMENT);
goto err;
+ }
listener = (SilcNetListener)silc_calloc(1, sizeof(*listener));
if (!listener) {
SILC_LOG_DEBUG(("Creating TCP listener"));
- if (!schedule || !callback)
+ if (!schedule) {
+ schedule = silc_schedule_get_global();
+ if (!schedule) {
+ silc_set_errno(SILC_ERR_INVALID_ARGUMENT);
+ goto err;
+ }
+ }
+
+ if (!callback) {
+ silc_set_errno(SILC_ERR_INVALID_ARGUMENT);
goto err;
+ }
listener = (SilcNetListener)silc_calloc(1, sizeof(*listener));
if (!listener) {
SilcResult status;
TInt ret;
- if (!remote_ip_addr || remote_port < 1 || !schedule || !callback)
+ if (!schedule) {
+ schedule = silc_schedule_get_global();
+ if (!schedule) {
+ silc_set_errno(SILC_ERR_INVALID_ARGUMENT);
+ return NULL;
+ }
+ }
+
+ if (!remote_ip_addr || remote_port < 1 || !callback) {
+ silc_set_errno(SILC_ERR_INVALID_ARGUMENT);
return NULL;
+ }
SILC_LOG_DEBUG(("Creating connection to host %s port %d",
remote_ip_addr, remote_port));
SILC_LOG_DEBUG(("Creating UDP stream"));
- if (!schedule)
- goto err;
+ if (!schedule) {
+ schedule = silc_schedule_get_global();
+ if (!schedule) {
+ silc_set_errno(SILC_ERR_INVALID_ARGUMENT);
+ goto err;
+ }
+ }
SILC_LOG_DEBUG(("Binding to local address %s",
local_ip_addr ? local_ip_addr : "0.0.0.0"));