From 86e3310be0eeab01028c00118941a6712e0574fb Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 9 Mar 2015 15:44:27 +0300 Subject: [PATCH] Some bugfixes (in serialization) and improvements --- build/headers.lua | 26 +++++++++++++------------- build/wiola.lua | 8 +++++--- package.json | 2 +- src/wiola/headers.lua | 2 +- src/wiola/wiola.lua | 8 +++++--- 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/build/headers.lua b/build/headers.lua index 08c269f..f09316a 100644 --- a/build/headers.lua +++ b/build/headers.lua @@ -4,23 +4,23 @@ -- Date: 16.03.14 -- -ngx.header["Server"] = "wiola/Lua v0.3.2" +ngx.header["Server"] = "wiola/Lua v0.3.3" local wsProto = ngx.req.get_headers()["Sec-WebSocket-Protocol"] if wsProto then - local wsProtos = {} - local i = 1 + local wsProtos = {} + local i = 1 - for p in string.gmatch(wsProto, '([^, ]+)') do - wsProtos[#wsProtos+1] = p - end + for p in string.gmatch(wsProto, '([^, ]+)') do + wsProtos[#wsProtos+1] = p + end - while i <= #wsProtos do - if wsProtos[i] == 'wamp.2.json' or wsProtos[i] == 'wamp.2.msgpack' then - ngx.header["Sec-WebSocket-Protocol"] = wsProtos[i] - break - end - i = i + 1 - end + while i <= #wsProtos do + if wsProtos[i] == 'wamp.2.json' or wsProtos[i] == 'wamp.2.msgpack' then + ngx.header["Sec-WebSocket-Protocol"] = wsProtos[i] + break + end + i = i + 1 + end end diff --git a/build/wiola.lua b/build/wiola.lua index 34c76db..8a8b01e 100644 --- a/build/wiola.lua +++ b/build/wiola.lua @@ -5,7 +5,7 @@ -- local _M = { - _VERSION = '0.3.2', + _VERSION = '0.3.3', } _M.__index = _M @@ -16,7 +16,7 @@ setmetatable(_M, { end }) local wamp_features = { - agent = "wiola/Lua v0.3.2", + agent = "wiola/Lua v0.3.3", roles = { broker = { features = { @@ -303,6 +303,7 @@ function _M:receiveData(regId, data) local invoc = self.redis:array_to_hash(self.redis:hgetall("wiInvoc" .. dataObj[3])) local callerSess = self.redis:array_to_hash(self.redis:hgetall("wiSes" .. invoc.callerSesId)) + invoc.CallReqId = tonumber(invoc.CallReqId) if #dataObj == 6 then -- WAMP SPEC: [ERROR, CALL, CALL.Request|id, Details|dict, Error|uri, Arguments|list] @@ -482,7 +483,7 @@ function _M:receiveData(regId, data) end local calleeSess = self.redis:array_to_hash(self.redis:hgetall("wiSes" .. callee)) - local rpcRegId = self.redis:hget("wiSes" .. callee .. "RPCs", dataObj[4]) + local rpcRegId = tonumber(self.redis:hget("wiSes" .. callee .. "RPCs", dataObj[4])) local invReqId = self:_getRegId() self.redis:hmset("wiInvoc" .. invReqId, "CallReqId", dataObj[2], "callerSesId", regId) @@ -552,6 +553,7 @@ function _M:receiveData(regId, data) -- WAMP SPEC: [YIELD, INVOCATION.Request|id, Options|dict, Arguments|list, ArgumentsKw|dict] if session.isWampEstablished == 1 then local invoc = self.redis:array_to_hash(self.redis:hgetall("wiInvoc" .. dataObj[2])) + invoc.CallReqId = tonumber(invoc.CallReqId) local callerSess = self.redis:array_to_hash(self.redis:hgetall("wiSes" .. invoc.callerSesId)) local details = {} diff --git a/package.json b/package.json index 9c0748c..7c879a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Wiola", - "version": "0.3.2", + "version": "0.3.3", "description": "WAMP implementation in Lua", "repository": { "type": "git", diff --git a/src/wiola/headers.lua b/src/wiola/headers.lua index 1bb8f45..569936c 100644 --- a/src/wiola/headers.lua +++ b/src/wiola/headers.lua @@ -4,7 +4,7 @@ -- Date: 16.03.14 -- -ngx.header["Server"] = "wiola/Lua v0.3.2" +ngx.header["Server"] = "wiola/Lua v0.3.3" local wsProto = ngx.req.get_headers()["Sec-WebSocket-Protocol"] diff --git a/src/wiola/wiola.lua b/src/wiola/wiola.lua index d8aca41..ffcf19d 100644 --- a/src/wiola/wiola.lua +++ b/src/wiola/wiola.lua @@ -7,7 +7,7 @@ require "debug.var_dump" local _M = { - _VERSION = '0.3.2', + _VERSION = '0.3.3', } _M.__index = _M @@ -18,7 +18,7 @@ setmetatable(_M, { end }) local wamp_features = { - agent = "wiola/Lua v0.3.2", + agent = "wiola/Lua v0.3.3", roles = { broker = { features = { @@ -319,6 +319,7 @@ function _M:receiveData(regId, data) local invoc = self.redis:array_to_hash(self.redis:hgetall("wiInvoc" .. dataObj[3])) local callerSess = self.redis:array_to_hash(self.redis:hgetall("wiSes" .. invoc.callerSesId)) + invoc.CallReqId = tonumber(invoc.CallReqId) if #dataObj == 6 then -- WAMP SPEC: [ERROR, CALL, CALL.Request|id, Details|dict, Error|uri, Arguments|list] @@ -504,7 +505,7 @@ function _M:receiveData(regId, data) end local calleeSess = self.redis:array_to_hash(self.redis:hgetall("wiSes" .. callee)) - local rpcRegId = self.redis:hget("wiSes" .. callee .. "RPCs", dataObj[4]) + local rpcRegId = tonumber(self.redis:hget("wiSes" .. callee .. "RPCs", dataObj[4])) local invReqId = self:_getRegId() self.redis:hmset("wiInvoc" .. invReqId, "CallReqId", dataObj[2], "callerSesId", regId) @@ -574,6 +575,7 @@ function _M:receiveData(regId, data) -- WAMP SPEC: [YIELD, INVOCATION.Request|id, Options|dict, Arguments|list, ArgumentsKw|dict] if session.isWampEstablished == 1 then local invoc = self.redis:array_to_hash(self.redis:hgetall("wiInvoc" .. dataObj[2])) + invoc.CallReqId = tonumber(invoc.CallReqId) local callerSess = self.redis:array_to_hash(self.redis:hgetall("wiSes" .. invoc.callerSesId)) local details = {}