Disallow connections until server is loaded
#1

As in title. Basically, there's a massive amount of things that are happening in my OnGamemodeInit (y_malloc allocations, y_text loading and a lot of queries (threaded though)). Can I somehow disallow any connections until I trigger it somehow from my gamemode? I know there exists something like iptables, maybe it would be possible to write connection dropping rules in them via some plugin and then restore previous settings?
Reply
#2

Well, I thought about the same problem few months ago. The solution to properly load the gamemode without letting players in was to kick players and tell them to reconnect in the reason (pretty dumb), the reason for that was that I was loading everything (houses, races and more) threaded too. I wanted to fix this kicking issue, as players got kicked a lot when the server just restarted. The solution I came with was to use mysql_query instead of mysql_t/pquery. This is a lot better, you don't need to use threaded queries under OnGameModeInit. Just remember to delete the result from mysql_query. Connections will just wait until OnGameModeInit finishes. I find this to be the best method. The only problem is that, AFAIK, SA-MP kicks players by itself when they are trying to connect with no success - like when the server hangs TOO MUCH in some code [usually infinite loops]) There's no other need to limit connections than those threaded queries, YSI inits everything fine at OnGameModeInit, without any need to wait a bit until after the startup.

EDIT: This may help you to change your mysql_tquery lines to mysql_query: https://github.com/pBlueG/SA-MP-MySQL/issues/76 .
Reply
#3

My DayZ server had similar need, what the creator had done was locking the server on init and call the function startserver() when loading was done to remove password.
Reply
#4

The password looks simple and promising, I'll definitely give it a try
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)