Skip to content

Commit

Permalink
Some bugfixes (in serialization) and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Burkalev authored and Konstantin Burkalev committed Mar 9, 2015
1 parent cf69816 commit 86e3310
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
26 changes: 13 additions & 13 deletions build/headers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 5 additions & 3 deletions build/wiola.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
--

local _M = {
_VERSION = '0.3.2',
_VERSION = '0.3.3',
}

_M.__index = _M
Expand All @@ -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 = {
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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 = {}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Wiola",
"version": "0.3.2",
"version": "0.3.3",
"description": "WAMP implementation in Lua",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/wiola/headers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
8 changes: 5 additions & 3 deletions src/wiola/wiola.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
require "debug.var_dump"

local _M = {
_VERSION = '0.3.2',
_VERSION = '0.3.3',
}

_M.__index = _M
Expand All @@ -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 = {
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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 = {}
Expand Down

0 comments on commit 86e3310

Please sign in to comment.