aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-06-02 17:25:01 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-06-02 17:25:01 +0500
commit961f01d6e9cac747e90c9509e64083116fef66cd (patch)
treea1b5d0f93445acba2ed81e6dcff68a81d724162f
parent719111c90dd9b0c4705989cc9db752f60cf53b9b (diff)
downloadprosody-961f01d6e9cac747e90c9509e64083116fef66cd.tar.gz
prosody-961f01d6e9cac747e90c9509e64083116fef66cd.zip
net.multiplex_listener: Test to make sure listener.onconnect isn't nil.
-rw-r--r--net/multiplex_listener.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/multiplex_listener.lua b/net/multiplex_listener.lua
index dbd7ea13..b515ccce 100644
--- a/net/multiplex_listener.lua
+++ b/net/multiplex_listener.lua
@@ -19,6 +19,8 @@ function server.onincoming(conn, data)
if buf:match("^[a-zA-Z]") then
local listener = httpserver_listener;
conn:setlistener(listener);
+ local onconnect = listener.onconnect;
+ if onconnect then onconnect(conn) end
listener.onincoming(conn, buf);
elseif buf:match(">") then
local listener;
@@ -31,7 +33,8 @@ function server.onincoming(conn, data)
listener = xmppclient_listener;
end
conn:setlistener(listener);
- listener.onconnect(conn);
+ local onconnect = listener.onconnect;
+ if onconnect then onconnect(conn) end
listener.onincoming(conn, buf);
elseif #buf > 1024 then
conn:close();