Commit 6b4d745d authored by mercury233's avatar mercury233

fix memory full

parent 2a1ef466
...@@ -4,6 +4,7 @@ http = require 'http' ...@@ -4,6 +4,7 @@ http = require 'http'
url = require 'url' url = require 'url'
path = require 'path' path = require 'path'
fs = require 'fs' fs = require 'fs'
os = require 'os'
execFile = require('child_process').execFile execFile = require('child_process').execFile
#三方库 #三方库
...@@ -190,7 +191,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -190,7 +191,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
} }
client.end() client.end()
else if (os.freemem() / os.totalmem())>=0.1 else if (os.freemem() / os.totalmem())>=0.9
ygopro.stoc_send_chat(client,"服务器已经爆满,请稍候再试") ygopro.stoc_send_chat(client,"服务器已经爆满,请稍候再试")
ygopro.stoc_send client, 'ERROR_MSG',{ ygopro.stoc_send client, 'ERROR_MSG',{
msg: 1 msg: 1
......
// Generated by CoffeeScript 1.9.3 // Generated by CoffeeScript 1.9.3
(function() { (function() {
var Deck, Inotify, Room, User, WebSocketServer, _, bunyan, debug, dialogues, execFile, fs, http, http_server, i, inotify, level_points, log, mycard, net, originIsAllowed, path, request, settings, tips, url, victories, waiting, wsServer, ygopro, var Deck, Inotify, Room, User, WebSocketServer, _, bunyan, debug, dialogues, execFile, fs, http, http_server, i, inotify, level_points, log, mycard, net, originIsAllowed, os, path, request, settings, tips, url, victories, waiting, wsServer, ygopro,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
net = require('net'); net = require('net');
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
fs = require('fs'); fs = require('fs');
os = require('os');
execFile = require('child_process').execFile; execFile = require('child_process').execFile;
_ = require('underscore'); _ = require('underscore');
...@@ -236,6 +238,13 @@ ...@@ -236,6 +238,13 @@
code: 2 code: 2
}); });
return client.end(); return client.end();
} else if ((os.freemem() / os.totalmem()) >= 0.9) {
ygopro.stoc_send_chat(client, "服务器已经爆满,请稍候再试");
ygopro.stoc_send(client, 'ERROR_MSG', {
msg: 1,
code: 2
});
return client.end();
} else if (!Room.validate(info.pass)) { } else if (!Room.validate(info.pass)) {
ygopro.stoc_send_chat(client, "房间密码不正确"); ygopro.stoc_send_chat(client, "房间密码不正确");
ygopro.stoc_send(client, 'ERROR_MSG', { ygopro.stoc_send(client, 'ERROR_MSG', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment