External Command Handler?

Posted by Kris on Fri 04 Oct 2002 09:22 PM — 5 posts, 22,455 views.

USA #0
Heya Nick. I was talking with Trax earlier about a fascinating idea. It would be really awesome if there was a way to add/modify code without having to reboot/recompile the main mud itself.

There are only two ways I can think of. One is having a seperate .exe command handler process, which the main mud could call. That way, you'd only have to recompile the handler, not the mud itself. However, to do this, they would both have to have a shared memory space between them; I have no idea how that would be accomplished, or even if the API calls exist for that.

The other idea is to have .dll extentions that the mud could use. However, I have no idea if cygwin is capable of compiling/linking dll files. Plus if it can, I'd have no idea how. Trax is a unix man, so he's about as clueless as I am; tho he did something similar successfully on his mud running in a unix environment.

Do you have any ideas about this? I think it would be really awesome if smaug could be adapted for something like this under windows =)

--Kris
Australia Forum Administrator #1
You could probably make that to work, although I'm not sure about Cygwin. Under normal Windows I think you could dynamically add a DLL and then un-add it later, and replace with a different one.

Another approach that some servers are taking (eg., Dawn Of Time, PennMUSH) is to support "hot rebooting" which is a reboot of the server, but keeping all players connected.

I think Cygwin has some dynamic library support but I am not really an expert on those, so I can't say how well they would work.
USA #2
Ahh yah I have hotboot on my server already; the copyover smaug snippet. However, that won't work for a recompile; the copyover occurs too quickly. Hmm well I'll keep toying with ideas then; even if cygwin could do that dll stuff, I'd have no idea how to do it anyways hehe.
Australia Forum Administrator #3
Here's another approach that might work. You could separate out the comms (needed to keep players connected) from the rest of the system, and "pipe" commands from one to the other, and then pipe the responses back. That way you could conceivably drop the command handler and quickly replace it, whilst keeping the connections alive. Not sure if it is worth it, just a reboot at 3 am might do the trick (of course, 3 am in one part of the world is prime time in another part).
#4
I am not sure if it is possible under windows, but in *nix you need to look at the dl* system calls, dlopen, dlsym, dlclose, and dlerror, These will load and unload shared libraries. My mud (PirateMud) has basic support for dso's, I currently am only using them for spec. function's but have plans to incorperate them into other things. There is a performance loss, and I am not sure if I will keep it in place, it's just as easy to recompile and reboot :p

Personally, the copyover stuff I have looked at is questionable, I forsee too many adverse problems of using such a system..

-Druid