Author Topic: NWNX2 - Anyone made a *real* reset plugin?  (Read 817 times)

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0
NWNX2 - Anyone made a *real* reset plugin?
« on: January 20, 2012, 10:32:13 am »


               By "A real reset plugin" I mean one which shuts the server down gracefully.

A plugin which sends the "close window" command to the server, then waits to see if a child window pops up and if it does, sends the "Yes" reply to it, and stops waiting once the server shuts down, whether or not a child window was needed.

A plugin which, if the server hasn't shut down after a reasonable amount of time (configurable but default to 20 seconds), then forces an instant shutdown.

I don't have the knowledge of DLLs or C/C++ to code this but surely it can't be so difficult?  Is there one already?  If not, why not and can't someone make one?

I'm sure I can't be the only person who wants this plugin.
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
NWNX2 - Anyone made a *real* reset plugin?
« Reply #1 on: January 22, 2012, 05:34:01 am »


               You could port my code for xp_srvadmin to NWNX2 if you wanted to do this.  (I don't have a NWNX2 build environment, sorry.)

The actual code to manipulate the shutdown button there is likely the same for NWN1 at least on Windows.
               
               

               
            

Legacy_virusman

  • Sr. Member
  • ****
  • Posts: 448
  • Karma: +0/-0
NWNX2 - Anyone made a *real* reset plugin?
« Reply #2 on: January 22, 2012, 09:12:24 pm »


               Done.
http://nwn.virusman..../changeset/112/
http://data.virusman...t-0.2-win32.rar
Note that call has been changed from "NWNX!RESETPLUGIN!SHUTDOWN" to "NWNX!RESET!SHUTDOWN".
               
               

               


                     Modifié par virusman, 22 janvier 2012 - 09:13 .
                     
                  


            

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0
NWNX2 - Anyone made a *real* reset plugin?
« Reply #3 on: January 24, 2012, 04:15:36 am »


               Impressive work, virusman.  And almost what I want except that it doesn't protect against a server "hang" during shutdown.

Could you use the number passed through the function as a timeout value and make the function force-shutdown the server after the timeout if it hasn't already done so?

I'd suggest that if the value is less than a sensible minimum (20 or 30 seconds, perhaps) that the sensible minimum delay be used instead.  Otherwise the value passed in is the number of seconds to wait for the shutdown to finish before sending a force-shutdown command.

Or would such protection be redundant?  Does NWNX2 already provide this through its own monitoring functions?  I haven't noticed nwnx2 forcing my server to shut down when it's gotten "hung up" during shutdown, but maybe I'm just too impatient to wait for it. '-_-'
               
               

               


                     Modifié par Melkior_King, 24 janvier 2012 - 04:17 .