Skip to content
Snippets Groups Projects
Commit 9fc2989a authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@2773 51575b47-30f0-44d4-a5cc-537603b46e54
parent 7f666cc3
No related branches found
No related tags found
No related merge requests found
......@@ -437,10 +437,9 @@ function _M:logOut()
profile.generic.online = nil
profile.auth = nil
local restore = fs.getWritePath()
fs.setWritePath(engine.homepath)
fs.delete("/profiles/"..self.name.."/generic/online.profile")
if restore then fs.setWritePath(restore) end
local pop = self:mountProfile(true)
fs.delete("/generic/online.profile")
self:umountProfile(true, pop)
end
function _M:getConfigs(module, cb)
......
......@@ -75,7 +75,7 @@ function _M:pread(ncode)
if not l then
if err == "closed" then
print("[PROFILE] push connection disrupted, trying to reconnect", err)
self:disconnect()
self.psock = nil
end
return nil
end
......@@ -112,19 +112,27 @@ end
function _M:step()
if self:connected() then
local rready = socket.select({self.psock}, nil, 0)
if not self.psock and self.auth then self:connectedPull() end
local socks = {}
if self.sock then socks[#socks+1] = self.sock end
if self.psock then socks[#socks+1] = self.psock end
local rready = socket.select(socks, nil, 0)
if rready[self.psock] then
local l = self:pread()
if l then
local code = l:sub(1, 3)
local data = l:sub(5)
print("<<<<<<<", code, "::", data)
if code == "101" then
local e = data:unserialize()
if e and e.e and self["push"..e.e] then self["push"..e.e](self, e) end
end
end
end
if rready[self.sock] then
local l = self:read()
if l then print("[PROFILE] req/rep thread got unwanted data", l) end
end
return true
end
return false
......@@ -261,3 +269,12 @@ function _M:pushCode(o)
cprofile.pushEvent(string.format("e='PushCode' code=%q", o.code))
end
end
function _M:pushChatTalk(o)
if o.profile then
local f = loadstring(o.code)
if f then pcall(f) end
else
cprofile.pushEvent(string.format("e='PushCode' code=%q", o.code))
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment