From 97294453585066bfcd88769c6e82f03158bd2ad0 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Wed, 9 May 2007 19:58:59 +0000 Subject: [PATCH] Do not set accepted stream or UDP stream by default into non-blocking mode. Set non-blocking mode always when socket stream notifier is called. --- lib/silcutil/unix/silcunixnet.c | 4 ---- lib/silcutil/unix/silcunixsocketstream.c | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/silcutil/unix/silcunixnet.c b/lib/silcutil/unix/silcunixnet.c index 76eba36e..20a55ebb 100644 --- a/lib/silcutil/unix/silcunixnet.c +++ b/lib/silcutil/unix/silcunixnet.c @@ -114,7 +114,6 @@ SILC_TASK_CALLBACK(silc_net_accept) return; /* Set socket options */ - silc_net_set_socket_nonblock(sock); silc_net_set_socket_opt(sock, SOL_SOCKET, SO_REUSEADDR, 1); /* Create socket stream */ @@ -298,9 +297,6 @@ silc_net_udp_connect(const char *local_ip_addr, int local_port, goto err; } - /* Set socket to non-blocking mode */ - silc_net_set_socket_nonblock(sock); - /* Set to connected state if remote address is provided. */ if (remote_ip_addr && remote_port) { if (!silc_net_set_sockaddr(&server, remote_ip_addr, remote_port)) diff --git a/lib/silcutil/unix/silcunixsocketstream.c b/lib/silcutil/unix/silcunixsocketstream.c index f3107f39..4b5f0ac1 100644 --- a/lib/silcutil/unix/silcunixsocketstream.c +++ b/lib/silcutil/unix/silcunixsocketstream.c @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2006 Pekka Riikonen + Copyright (C) 1997 - 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 @@ -313,6 +313,9 @@ SilcBool silc_socket_stream_notifier(SilcStream stream, socket_stream->schedule = schedule; if (socket_stream->notifier && socket_stream->schedule) { + /* Set the socket to non-blocking mode */ + silc_net_set_socket_nonblock(socket_stream->sock); + /* Add the socket to scheduler. Safe to call if already added. */ if (!silc_schedule_task_add_fd(socket_stream->schedule, socket_stream->sock, -- 2.24.0