X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Funix%2Fsilcunixnet.c;h=15720dcd53691f8903f6141776aaf7ac636fbb7f;hb=e7b6c157b80152bf9fb9266e6bdd93f9fb0db776;hp=de7eeaee881d333af97733a7747d21f275bbc8bf;hpb=51558729d89b9f3492b2ca754242ed548a579ca4;p=silc.git diff --git a/lib/silcutil/unix/silcunixnet.c b/lib/silcutil/unix/silcunixnet.c index de7eeaee..15720dcd 100644 --- a/lib/silcutil/unix/silcunixnet.c +++ b/lib/silcutil/unix/silcunixnet.c @@ -143,7 +143,15 @@ silc_net_tcp_create_listener(const char **local_ip_addr, 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; } @@ -253,7 +261,15 @@ silc_net_tcp_create_listener2(const char *local_ip_addr, int *ports, 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; } @@ -397,8 +413,11 @@ silc_net_udp_connect(const char *local_ip_addr, int local_port, SILC_LOG_DEBUG(("Creating UDP stream")); if (!schedule) { - silc_set_errno(SILC_ERR_INVALID_ARGUMENT); - goto err; + schedule = silc_schedule_get_global(); + if (!schedule) { + silc_set_errno(SILC_ERR_INVALID_ARGUMENT); + goto err; + } } /* Bind to local addresses */ @@ -872,8 +891,18 @@ SilcAsyncOperation silc_net_tcp_connect(const char *local_ip_addr, { SilcNetConnect conn; - 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));