mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
bugfix: mongo disconnect. self.__sock can't be nil because of metatable
This commit is contained in:
@@ -97,7 +97,7 @@ local function reply_queue(obj)
|
|||||||
while true do
|
while true do
|
||||||
local len_reply = socket.read(sock, 4)
|
local len_reply = socket.read(sock, 4)
|
||||||
if not len_reply then
|
if not len_reply then
|
||||||
if obj.__sock == nil then
|
if not obj.__sock then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
sock = reconnect(obj)
|
sock = reconnect(obj)
|
||||||
@@ -105,7 +105,7 @@ local function reply_queue(obj)
|
|||||||
local length = driver.length(len_reply)
|
local length = driver.length(len_reply)
|
||||||
local reply = socket.read(sock, length)
|
local reply = socket.read(sock, length)
|
||||||
if not reply then
|
if not reply then
|
||||||
if obj.__sock == nil then
|
if not obj.__sock then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
sock = reconnect(obj)
|
sock = reconnect(obj)
|
||||||
@@ -150,7 +150,7 @@ end
|
|||||||
function mongo_client:disconnect()
|
function mongo_client:disconnect()
|
||||||
if self.__sock then
|
if self.__sock then
|
||||||
local so = self.__sock
|
local so = self.__sock
|
||||||
self.__sock = nil
|
self.__sock = false
|
||||||
socket.close(so)
|
socket.close(so)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user