mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-10 15:48:06 -05:00
Aha, _that's_ why I've been periodically getting blocking-write
problems using Unix PuTTY port forwarding. Sockets we create by connect() are immediately set into nonblocking mode by fcntl, but sockets we create by accept() were not. This trivial fix should help. [originally from svn r7864]
This commit is contained in:
parent
c639a04a1f
commit
5e42fe8fc9
@ -1077,6 +1077,7 @@ static int net_select_result(int fd, int event)
|
||||
#endif
|
||||
socklen_t addrlen = sizeof(ss);
|
||||
int t; /* socket of connection */
|
||||
int fl;
|
||||
|
||||
memset(&ss, 0, addrlen);
|
||||
t = accept(s->s, (struct sockaddr *)&ss, &addrlen);
|
||||
@ -1084,6 +1085,10 @@ static int net_select_result(int fd, int event)
|
||||
break;
|
||||
}
|
||||
|
||||
fl = fcntl(t, F_GETFL);
|
||||
if (fl != -1)
|
||||
fcntl(t, F_SETFL, fl | O_NONBLOCK);
|
||||
|
||||
if (s->localhost_only &&
|
||||
!sockaddr_is_loopback((struct sockaddr *)&ss)) {
|
||||
close(t); /* someone let nonlocal through?! */
|
||||
|
Loading…
x
Reference in New Issue
Block a user