diff --git a/game-server/app.js b/game-server/app.js index 2a115da..16e4d33 100644 --- a/game-server/app.js +++ b/game-server/app.js @@ -28,10 +28,12 @@ var chatRoute = function(session, msg, app, cb) { cb(new Error('can not find chat servers.')); return; } + var uid = session.get('uid'); + if (uid) { + var res = dispatcher.dispatch(uid, chatServers); - var res = dispatcher.dispatch(session.get('uid'), chatServers); - - cb(null, res.id); + cb(null, res.id); + } }; // app configuration diff --git a/proxy/client.test.js b/proxy/client.test.js index 3f7ef86..aab53cd 100644 --- a/proxy/client.test.js +++ b/proxy/client.test.js @@ -4,7 +4,8 @@ const { Message } = require("./Message"); const port = 4999; // const host = "192.168.100.173"; -const host = "r2.cebggame.com"; +const host = "62.234.46.11"; +//const host = "r2.cebggame.com"; const stick = new Stick(1024); stick.setMaxBodyLen(MaxBodyLen["32K"], true); @@ -110,8 +111,8 @@ beforeAll(() => { serial: 123456, route: "gate.gateHandler.queryEntry", params: { - // uid: "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340", - uid: "6516_2006_0xa5069f54f2ed021e0ac47dbb385420a0d5f41be3", + uid: "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340", + // uid: "6516_2006_0xa5069f54f2ed021e0ac47dbb385420a0d5f41be3", }, }; client.write(stick.makeData(Message.TYPE_REQUEST, JSON.stringify(param))); @@ -123,8 +124,8 @@ describe("client", () => { let msg; test("entry", async () => { - // msg = await rpc("connector.entryHandler.entry", { uid: "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340", }); - msg = await rpc("connector.entryHandler.entry", { uid: "6516_2006_0xa5069f54f2ed021e0ac47dbb385420a0d5f41be3", }); + msg = await rpc("connector.entryHandler.entry", { uid: "6516_2006_0xef59f6cc4d190a0ae576c46d4583e92b61174340", }); + // msg = await rpc("connector.entryHandler.entry", { uid: "6516_2006_0xa5069f54f2ed021e0ac47dbb385420a0d5f41be3", }); console.log(msg); expect(msg.code).toBe(200); }); diff --git a/proxy/lib/deps/pomelo-jsclient.js b/proxy/lib/deps/pomelo-jsclient.js index a30b3b3..75dbf88 100644 --- a/proxy/lib/deps/pomelo-jsclient.js +++ b/proxy/lib/deps/pomelo-jsclient.js @@ -161,7 +161,13 @@ class PomeloClient extends EventEmitter { } processPackage(msg) { - this.handlers[msg.type](msg.body); + try { + this.handlers[msg.type](msg.body); + } + catch (ex) { + console.log("processPackage msg: ", msg); + console.error("processPackage error: ", ex); + } } heartbeat(data) {