Commit 6b4d745d authored by mercury233's avatar mercury233

fix memory full

parent 2a1ef466
......@@ -4,6 +4,7 @@ http = require 'http'
url = require 'url'
path = require 'path'
fs = require 'fs'
os = require 'os'
execFile = require('child_process').execFile
#三方库
......@@ -190,7 +191,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
}
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 client, 'ERROR_MSG',{
msg: 1
......
// Generated by CoffeeScript 1.9.3
(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; };
net = require('net');
......@@ -13,6 +13,8 @@
fs = require('fs');
os = require('os');
execFile = require('child_process').execFile;
_ = require('underscore');
......@@ -236,6 +238,13 @@
code: 2
});
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)) {
ygopro.stoc_send_chat(client, "房间密码不正确");
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