summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-18 08:01:56 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-18 08:01:56 +0800
commitcd139961035597bc03422fc510c2c3aa0ce99ff0 (patch)
tree71b71424e91ee01aa3df819d0bba774c98927b3d /daemon
parent8b4f9ff1fdff129e7419a57803932a305efd0290 (diff)
downloadpttbbs-cd139961035597bc03422fc510c2c3aa0ce99ff0.tar
pttbbs-cd139961035597bc03422fc510c2c3aa0ce99ff0.tar.gz
pttbbs-cd139961035597bc03422fc510c2c3aa0ce99ff0.tar.bz2
pttbbs-cd139961035597bc03422fc510c2c3aa0ce99ff0.tar.lz
pttbbs-cd139961035597bc03422fc510c2c3aa0ce99ff0.tar.xz
pttbbs-cd139961035597bc03422fc510c2c3aa0ce99ff0.tar.zst
pttbbs-cd139961035597bc03422fc510c2c3aa0ce99ff0.zip
* prevent using non-block mode for tunnel
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4651 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'daemon')
-rw-r--r--daemon/logind/logind.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/daemon/logind/logind.c b/daemon/logind/logind.c
index 164f667c..c1bfa993 100644
--- a/daemon/logind/logind.c
+++ b/daemon/logind/logind.c
@@ -677,9 +677,6 @@ _set_bind_opt(int sock)
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof(on));
_set_connection_opt(sock);
- if (g_nonblock)
- _enable_nonblock(sock);
-
return 0;
}
@@ -1214,7 +1211,7 @@ start_service(int fd, login_conn_ctx *conn)
// XXX simulate the cache re-construction in mbbsd/login_query.
resolve_garbage();
- // since mbbsd is running in blocking mode, let's re-configure fd.
+ // since mbbsd may be running in blocking mode, let's re-configure fd.
_disable_nonblock(fd);
// deliver the fd to hosting service
@@ -1773,12 +1770,6 @@ tunnel_cb(int fd, short event, void *arg)
fprintf(stderr, LOG_PREFIX "new tunnel established.\r\n");
_set_connection_opt(cfd);
- // XXX TODO enable non-blocking for this tunnel socket?
-#if 0
- if (g_nonblock)
- _enable_nonblock(cfd);
-#endif
-
stop_g_tunnel();
g_tunnel = cfd;
@@ -1807,6 +1798,11 @@ bind_port(int port)
fprintf(stderr, LOG_PREFIX "cannot bind to port: %d. abort.\r\n", port);
return -1;
}
+
+ // only set non-blocking to out ports (not for tunnel!)
+ if (g_nonblock)
+ _enable_nonblock(sfd);
+
pev = malloc (sizeof(bind_event));
memset(pev, 0, sizeof(bind_event));
assert(pev);