aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-01-21 12:56:08 +0000
committerMatthew Wild <mwild1@gmail.com>2010-01-21 12:56:08 +0000
commit4ec0f47224c55725182e2fefa1749fba77e6fc0a (patch)
treec014045a4e8eee1684aa25b599b2d368a78350d1 /net
parentd532b1173a36940f73046798371b8077af98d0b7 (diff)
downloadprosody-4ec0f47224c55725182e2fefa1749fba77e6fc0a.tar.gz
prosody-4ec0f47224c55725182e2fefa1749fba77e6fc0a.zip
net.server_{select,event}: Fail gracefully if socket doesn't have a setoption method (LuaSec issue I think)
Diffstat (limited to 'net')
-rw-r--r--net/server_event.lua5
-rw-r--r--net/server_select.lua5
2 files changed, 8 insertions, 2 deletions
diff --git a/net/server_event.lua b/net/server_event.lua
index a1403911..c01c85a6 100644
--- a/net/server_event.lua
+++ b/net/server_event.lua
@@ -420,7 +420,10 @@ do
end
function interface_mt:setoption(option, value)
- return self.conn:setoption(option, value);
+ if self.conn.setoption then
+ return self.conn:setoption(option, value);
+ end
+ return false, "setoption not implemented";
end
-- Stub handlers
diff --git a/net/server_select.lua b/net/server_select.lua
index 116b4327..682a155d 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -354,7 +354,10 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
return shutdown( socket, pattern )
end
handler.setoption = function (self, option, value)
- return socket:setoption(option, value);
+ if socket.setoption then
+ return socket:setoption(option, value);
+ end
+ return false, "setoption not implemented";
end
handler.close = function( self, forced )
if not handler then return true; end