aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2013-12-18 17:52:28 -0500
committerdaurnimator <quae@daurnimator.com>2013-12-18 17:52:28 -0500
commiteffb3a25414502e3aa0baad6a4d39d891397e07e (patch)
tree22354d680ef417bbbff5e27c227bbac124167f90 /net
parent0d4d70c625cbdf20d96dd568b490ef4c04525be1 (diff)
downloadprosody-effb3a25414502e3aa0baad6a4d39d891397e07e.tar.gz
prosody-effb3a25414502e3aa0baad6a4d39d891397e07e.zip
net/server_event: add_client should have same arguments no-matter the server backend
Diffstat (limited to 'net')
-rw-r--r--net/server_event.lua27
1 files changed, 6 insertions, 21 deletions
diff --git a/net/server_event.lua b/net/server_event.lua
index daac7746..00c99784 100644
--- a/net/server_event.lua
+++ b/net/server_event.lua
@@ -750,36 +750,21 @@ do
--function handleclient( client, ip, port, server, pattern, listener, _, sslctx ) -- creates an client interface
end
- function addclient( addr, serverport, listener, pattern, localaddr, localport, sslcfg, startssl )
+ function addclient( addr, serverport, listener, pattern, sslctx )
+ if sslctx and not ssl then
+ debug "need luasec, but not available"
+ return nil, "luasec not found"
+ end
local client, err = socket.tcp() -- creating new socket
if not client then
debug( "cannot create socket:", err )
return nil, err
end
client:settimeout( 0 ) -- set nonblocking
- if localaddr then
- local res, err = client:bind( localaddr, localport, -1 )
- if not res then
- debug( "cannot bind client:", err )
- return nil, err
- end
- end
- local sslctx
- if sslcfg then -- handle ssl/new context
- if not has_luasec then
- debug "need luasec, but not available"
- return nil, "luasec not found"
- end
- sslctx, err = sslcfg
- if err then
- debug( "cannot create new ssl context:", err )
- return nil, err
- end
- end
local res, err = client:connect( addr, serverport ) -- connect
if res or ( err == "timeout" ) then
local ip, port = client:getsockname( )
- local interface = wrapclient( client, ip, serverport, listener, pattern, sslctx, startssl )
+ local interface = wrapclient( client, ip, serverport, listener, pattern, sslctx )
interface:_start_connection( startssl )
debug( "new connection id:", interface.id )
return interface, err