summaryrefslogtreecommitdiffstats
path: root/freenx/build/freenx_fixresume.diff
blob: 278db1d10103a236002ca8619606bffd04ed6315 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
http://mail.kde.org/pipermail/freenx-knx/2009-January/007756.html

The key problem is that when the client nxssh is killed, nxserver hangs
in the echo inside server_nxnode_echo(). It attempts to handle this
situation by installing a SIGPIPE handler that sets
SERVER_CHANNEL=0. Unfortunately, SIGPIPE is never received in this
situation; instead the echo hangs forever. This is what causes it never
to process any more commands from nxnode.

It is not entirely clear why it happens in this way.

Anyway, the workaround is to change echo to /bin/echo. /bin/echo returns
immediately if the client is disconnected. Probably it should also check
the status and set SERVER_CHANNEL=0 if /bin/echo failed. However I have
not bothered to do this. It does not seem to matter a great deal.

--- nxserver.orig       2009-01-25 16:07:46.590977440 +1300
+++ nxserver    2009-01-25 16:07:54.498952944 +1300
@@ -967,8 +967,8 @@
 server_nxnode_echo()
 {
        log 6 "server_nxnode_echo: $@"
-       [ "$SERVER_CHANNEL" = "1" ] && echo "$@"
-       [ "$SERVER_CHANNEL" = "2" ] && echo "$@" >&2
+       [ "$SERVER_CHANNEL" = "1" ] && /bin/echo "$@"
+       [ "$SERVER_CHANNEL" = "2" ] && /bin/echo "$@" >&2
 }

 server_nxnode_exit_func()