2

I'm currently running a python game server based on Twisted's framework. It's a simple socket server that allows users to connect and play games with each other. Anyway, the main functions for each user (like grabbing a user's info, getting their friends, sending messages, etc) are all within the user class (LineReceiver). Occasionally, whenever a new function is created and tested to work fine, a user might find an issue with it or abuse it. That would mean I have to fix it quickly (not the issue here, I can do that fine) and then restart the whole server, which has around ~300 users connected and playing at once. That would mean they all had to re-login at one time, causing lag and a hard time for the server. Is there anyway I could update the function that has the issue (for example SetUserScore (score)) and not have to restart the server? All of the users information is stored in the user class as well.

I was thinking I could possibly move functions to a separate class and just store all individual user information, (display name, current game id, etc) in the user class. The separate class could then be reloaded upon the command of a game admin and then the user class would start using the new function every time it calls a function from there? Would this work?

kitti
  • 14,663
  • 31
  • 49
  • This can be done in C - basically the handles for the socket connections are saved to a file, then the right flavor of `exec()` is called to keep those connections open as the new version loads, then it reads that connection file to reestablish the already open connections. But to do this with Twisted would likely require some major changes to Twisted's code, and I don't know if Python can handle this type of `exec()`. – kitti Apr 29 '14 at 22:21
  • 1
    Add a better answer to the existing question if you think there is a better answer now. :) This is still a duplicate. – Jean-Paul Calderone Apr 30 '14 at 11:59

0 Answers0