> 1. I know that Java.exe does not properly shut down the node. That is
> the reason why I had introduced the ugly "TerminateProcess" (?) call to
> force the shutdown.
>
> 2. It saves about 3MB of RAM usage. I think that is worth it.

Ok, well, I have a 'workable' solution.  It's pretty simple

Step 1 - Run Freenet.node.gui.GUINode instead of Freenet.node.Node
Step 2 - When you want to shut the node down, enumerate all windows in the
system
Step 3 - Match each against the process id of the Freenet node process
(Steps 2 and 3 are trivial under Windows)
Step 4 - If the title of the window begins "Freenet node" (case insensitive)
then send it a WM_CLOSE message


This solves the following problem:
Cannot send java.exe a WM_CLOSE under Win9X as the operator system barfs
"Windows cannot shut this program down"


If, after applying Step 4, the node still appears to be running, then
fallback to the TerminateProcess mechanism.


Comments anyone?  I made the following list to get you started:
1.    Running Freenet.node.gui.GUINode 'hidden' is less efficient than
running Freenet.node.Node
2.    The freenet node window in GUINode must always begin with the text
"Freenet node" (case insensitive) for this scheme to work (can freenet devs
guarantee this?)


New freenet.exe will be in CVS in just a few moments ... also featuring a
fix for the stoopid race condition that was uncovered during all this
testing (weird that David McNab experienced it twice in one session - I was
trying to recreate his steps all last night and I was lucky in that I got it
to occur once!).  For those interested, the bug was

1.    Do a TerminateProcess()
2.    pronounce the freenet node 'dead'
3.    Restart the freenet node by spawning java.exe (or whatever)

Did you spot it?  Here's the fixed version

1.    Do a TerminateProcess()
2.    Actually wait for the JRE running the node to exit (otherwise there is
a chance we might spawn another node while the old one is still shutting
itself down)
...

Dave



_______________________________________________
Devl mailing list
Devl at freenetproject.org
http://lists.freenetproject.org/mailman/listinfo/devl

Reply via email to