Replacing Soldat's Fileserver
Here the updates go again… This time I rewrote Soldat's internal fileserver in Python.
Leo had problems with it on his TTW server which runs the Windows binary of soldatserver via wine because it runs better (that's at least his opinion) than the native Linux version, except for the fileserver which doesn't work with wine at all. So I went ahead and wrote it. It didn't work at the first try but with a lot of testing with Leo's help I got it stable and ready for posting here.
What it does:
- Serves only files that Soldat's fileserver would serve aswell
- Caches all files in memory (for now) as soon as they're first requested
- Handles lots of connections parallely through its non-blocking design
- Can listen on multiple ports and interfaces
What it doesn't do:
- Work with IPv6 (not yet at least)
How to use it:
All setup happens in server.py which loads the FileServe module. Basically you just create an instance of FileServe, addPort()s on it and then run().
You have to disable Soldat's fileserver. Just set Allow_Download=0 in the [Network] section of soldat.ini.
- FileServe.addPort(port, ip=None): binds to port and optionally to ip instead of the default IP
- FileServe.setDefaultIp(ip): sets the default IP to bind to
- FileServe.run(): runs the server in an infinite loop
- FileServe.setDataDir(dir): specify a directory where data files can be found (default: current working dir)