nxagent uses SIGHUP to switch from "active" to "suspend" mode and vice versa.
nxagent will go into suspend when (1) it gets a SIGHUP or (2) a currently 
connected nxproxy disconnects.

The for this behaviour is (presumably) to allow a new nxproxy from a different 
location to connect with different connection parameters (which changes how 
nxagent transmits data across the wire).

The trickery is to detect which state nxagent is currently in. If it is 
suspended SIGHUP will make it active, if it is active SIGHUP will suspend it.
Testing whether something is listening on the NX-Port (using fuser <port>/tcp) 
is enough to detect that case.

The 2nd complication is that if nxagent gets a SIGHUP while it is connected to 
an nxproxy, it will spawn a child process that waits for the nxproxy to 
disconnect, until this happens nxagent will not accept any signals. The 
solution here is to kill -HUP the child (if you want to force disconnect the 
other nxproxy) - here you use ps to determine the child process id.

nxagent shuts down when there are no X clients (but that be disabled through 
the -noreset). I have sessions parked for days without a viewer (nxproxy), 
which then resume fine. nxclient might try to be fancy here, which is why I'm 
not using it at all.

I assume if I had to build the NX server code myself I'd hate it too... What I 
hated was the obtuse FreeNX/nxclient stuff, and the constant fear that 
something between FreeNX and the nxclient will prevent my session from resuming 
(which happened all the time).

By using nxagent/nxproxy directly I've never had any problem.

I have a shell script that starts/resumes a remote nxagent through SSH and 
connects a local nxproxy to it, making it behave more like VNC.
I'll clean it up a little and post it here if people are interested.

-- Lars

----- Original Message ----

From: Nathaniel Smith <[email protected]>
To: lars hofhansl <[email protected]>
Cc: [email protected]
Sent: Monday, August 24, 2009 9:51:01 PM
Subject: Re: [Parti-discuss] Rootless NX

On Mon, Aug 24, 2009 at 9:11 PM, lars hofhansl<[email protected]> wrote:
> That is all that is needed to park and forward windows just like with Xpra. A 
> little bit trickery is needed to handle nxagents
> resume/suspend logic, but on the oher hand that allows changing 
> encoding/caching behavior between suspend/resume cycles.

Can you elaborate on the "little bit of trickery" you found needed?

I spent a few days trying to get exactly this working, and found
nxagent as shipped to not *quite* be usable. This was quite a while
ago and the details have faded, but IIRC the biggest dealbreaker was
that if you told it that you were going to reconnect your viewer, but
then did not do so within 30 seconds, then it just shut down and
killed all your long-running apps. Not something I was willing to
accept when dealing with flaky wifi.

Which is presumably fixable in principle, but to do so you have to
deal with an old and crufty code base (it's a fork of the old
monolithic X server tree) and the lack of any real upstream (NoMachine
Inc. just throws tarballs over the wall every once in a while,
figuring out how to get them to build is your problem, never mind
supporting your own fork). That's when I gave up and wrote xpra; the
first version of xpra literally took less time to write than I had
already spent trying to get nxagent going.

But if that's changed then I'd love to know.

-- Nathaniel


_______________________________________________
Parti-discuss mailing list
[email protected]
http://lists.partiwm.org/cgi-bin/mailman/listinfo/parti-discuss

Reply via email to