socketchannel is an independent mod now, channel:request will throw channel.error when disconnected.

This commit is contained in:
Cloud Wu
2014-03-24 16:12:02 +08:00
parent 20db82dc97
commit 911380d8b2
5 changed files with 312 additions and 302 deletions

View File

@@ -1,5 +1,6 @@
local bson = require "bson"
local socket = require "socket"
local socketchannel = require "socketchannel"
local skynet = require "skynet"
local driver = require "mongo.driver"
local rawget = rawget
@@ -78,7 +79,7 @@ end
function mongo.client( obj )
obj.port = obj.port or 27017
obj.__id = 0
obj.__sock = socket.channel {
obj.__sock = socketchannel.channel {
host = obj.host,
port = obj.port,
response = dispatch_reply,
@@ -285,4 +286,4 @@ function mongo_cursor:close()
end
end
return mongo
return mongo