Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Server Browser
02-03-2017, 08:49 AM,
Post: #1
Server Browser
The server browser on nanoid.net now queries both the master server and master2 (which also runs on nanoid.net) every minute. So if the master goes down, the browser will continue to update. Scanning is done by a scan.php script which is run with a cron job every minute. I copied the scan.php to scan2.php and changed the

MASTER=master.corservers.com
to

MASTER=master2.corservers.com
in scan2.php and both scripts run every minute.
If someone knows how to do this more effectively / cleanly within the scan.php please do so. The script is in SVN in the tools/web/scan/ folder.
The best would be to scan one server and after 30 seconds to scan the other server. That way the each server would be scanned every minute and the browser will be updated twice every minute.
[Image: animalt.png]

Chaingun Server Browser
http://hal.nanoid.net/arena/tools/browser
Save a tree or two. Use both sides of toilet paper.
Reply
02-03-2017, 05:10 PM,
Post: #2
RE: Server Browser
Bad idea... now the players and servers show double Sad
[Image: animalt.png]

Chaingun Server Browser
http://hal.nanoid.net/arena/tools/browser
Save a tree or two. Use both sides of toilet paper.
Reply
02-14-2017, 05:33 AM, (This post was last modified: 02-14-2017, 05:33 AM by berycz.)
Post: #3
RE: Server Browser
the scan.php is made to work just with one MASTER_ADDRESS, I looked into that and there are prolly 2 solutions

1. run the php script, check if there is the word "Aborting" in the output, if not, it's ok, if there is, run the php with the onother MASTER_ADDRESS
you could have scan.php and scan2.php - easier way is with the function include(), or pass the MASTER_ADDRESS as a cvar or GET/POST var or something

2. changing the code, so it will be able to work with an array of servers & ports

the second solution is cleaner, but harder Smile the problem is, when it can't connect for some reason, it calls die(...), which exits the script and doesn't continue and you can't catch it, like an exception...

btw, what php version do you have on your server? I've read that php has some Exceptions since v5 I think, that would be cleaner than calling die()

I could actually try to do the 2., if the devs don't have any problem with that... I dont make any promises about fixing it tho lol

I would even like to skin the server browser a little bit, cos now it's really ugly Smile
czech web about Alien Arena http://aa.berycz.net/ and my "blog" about programming in python and traveling http://www.berycz.net/
Reply
02-14-2017, 09:24 AM,
Post: #4
RE: Server Browser
(02-14-2017, 05:33 AM)berycz Wrote: the scan.php is made to work just with one MASTER_ADDRESS, I looked into that and there are prolly 2 solutions

1. run the php script, check if there is the word "Aborting" in the output, if not, it's ok, if there is, run the php with the onother MASTER_ADDRESS
you could have scan.php and scan2.php - easier way is with the function include(), or pass the MASTER_ADDRESS as a cvar or GET/POST var or something

2. changing the code, so it will be able to work with an array of servers & ports

the second solution is cleaner, but harder Smile the problem is, when it can't connect for some reason, it calls die(...), which exits the script and doesn't continue and you can't catch it, like an exception...

btw, what php version do you have on your server? I've read that php has some Exceptions since v5 I think, that would be cleaner than calling die()

I could actually try to do the 2., if the devs don't have any problem with that... I dont make any promises about fixing it tho lol

I would even like to skin the server browser a little bit, cos now it's really ugly Smile
I had trouble with php when I did a dist-upgrade on my server. The browser broke with the newer version of php so I had to install the older version in order to keep the browser working.

Doing a php -v i get:
PHP 5.3.3-7+squeeze19 with Suhosin-Patch (cli) (built: Feb 17 2014 10:10:23).

I think the newer version that was installed was 5.5, but I'm not sure.
As for the devs having a problem if you fix it, I don't think they will mind, since the browser was made from tony. If you do fix it though you could ask the devs to include the changes in SVN. And yeah it is kinda ugly, but it gets it's job done. A little polish wouldn't hurt Smile

Nanoid also runs the master2 server. I can change the script to just query master2. If master goes down the browser will still be up to date. So as long as nanoid is up (99,9% uptime) we will still have the browser up to date.

Do what you can if you can Smile
[Image: animalt.png]

Chaingun Server Browser
http://hal.nanoid.net/arena/tools/browser
Save a tree or two. Use both sides of toilet paper.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)