summaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'app.js')
-rw-r--r--app.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/app.js b/app.js
index b755319..ad011d8 100644
--- a/app.js
+++ b/app.js
@@ -51,6 +51,17 @@ function secondsToString(seconds)
}
+function checkp(key){
+ ps.checkPortStatus(key, 'cnjoe.info', function(error, status) {
+ // Status is 'open' if currently in use or 'closed' if available
+ console.log(key,status);
+ if (status=='open')
+ serverstat.pcs[key]=true;
+ else
+ serverstat.pcs[key]=false;
+ })
+}
+
function refreshStat(){
ps.checkPortStatus(25565, 'cnjoe.info', function(error, status) {
// Status is 'open' if currently in use or 'closed' if available
@@ -61,13 +72,7 @@ function refreshStat(){
})
for (key in serverstat.pcs) {
if (serverstat.pcs.hasOwnProperty(key)) {
- ps.checkPortStatus(key, 'cnjoe.info', function(error, status) {
- // Status is 'open' if currently in use or 'closed' if available
- if (status=='open')
- serverstat.pcs[key]=true;
- else
- serverstat.pcs[key]=false;
- })
+ checkp(key);
}
}
getmem();