From 1fdce9941bd387fff17a50d2cb467b9ee441835c Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Fri, 21 Mar 2014 11:03:16 +0800 Subject: [PATCH] bugfix: mongo disconnect. self.__sock can't be nil because of metatable --- lualib/mongo.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lualib/mongo.lua b/lualib/mongo.lua index b67c5816..e4116f4e 100644 --- a/lualib/mongo.lua +++ b/lualib/mongo.lua @@ -97,7 +97,7 @@ local function reply_queue(obj) while true do local len_reply = socket.read(sock, 4) if not len_reply then - if obj.__sock == nil then + if not obj.__sock then return end sock = reconnect(obj) @@ -105,7 +105,7 @@ local function reply_queue(obj) local length = driver.length(len_reply) local reply = socket.read(sock, length) if not reply then - if obj.__sock == nil then + if not obj.__sock then return end sock = reconnect(obj) @@ -150,7 +150,7 @@ end function mongo_client:disconnect() if self.__sock then local so = self.__sock - self.__sock = nil + self.__sock = false socket.close(so) end end