diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-06-02 17:25:01 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-06-02 17:25:01 +0500 |
commit | 961f01d6e9cac747e90c9509e64083116fef66cd (patch) | |
tree | a1b5d0f93445acba2ed81e6dcff68a81d724162f /net | |
parent | 719111c90dd9b0c4705989cc9db752f60cf53b9b (diff) | |
download | prosody-961f01d6e9cac747e90c9509e64083116fef66cd.tar.gz prosody-961f01d6e9cac747e90c9509e64083116fef66cd.zip |
net.multiplex_listener: Test to make sure listener.onconnect isn't nil.
Diffstat (limited to 'net')
-rw-r--r-- | net/multiplex_listener.lua | 5 |
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(); |