aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_event.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-12-23 17:55:41 +0100
committerKim Alvefur <zash@zash.se>2013-12-23 17:55:41 +0100
commitae81ea6edae7c3b151aa831324ff5d80fbc238fa (patch)
tree385240a3cc3fa639d82cb948e2a7846f605b5f1c /net/server_event.lua
parent03b5e2a257b036b3915d7905682ffef025858a19 (diff)
downloadprosody-ae81ea6edae7c3b151aa831324ff5d80fbc238fa.tar.gz
prosody-ae81ea6edae7c3b151aa831324ff5d80fbc238fa.zip
net.server_{select,event}: addclient: Add argument for overriding socket type
Diffstat (limited to 'net/server_event.lua')
-rw-r--r--net/server_event.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/server_event.lua b/net/server_event.lua
index 7575044a..bc67d175 100644
--- a/net/server_event.lua
+++ b/net/server_event.lua
@@ -742,12 +742,19 @@ do
--function handleclient( client, ip, port, server, pattern, listener, _, sslctx ) -- creates an client interface
end
- function addclient( addr, serverport, listener, pattern, sslctx )
+ function addclient( addr, serverport, listener, pattern, sslctx, typ )
if sslctx and not has_luasec then
debug "need luasec, but not available"
return nil, "luasec not found"
end
- local client, err = socket.tcp() -- creating new socket
+ if not typ then
+ typ = "tcp"
+ end
+ local create = socket[typ]
+ if type( create ) ~= "function" then
+ return nil, "invalid socket type"
+ end
+ local client, err = create() -- creating new socket
if not client then
debug( "cannot create socket:", err )
return nil, err