aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/connect.lua2
-rw-r--r--net/server_epoll.lua4
-rw-r--r--net/server_event.lua4
-rw-r--r--net/server_select.lua4
4 files changed, 7 insertions, 7 deletions
diff --git a/net/connect.lua b/net/connect.lua
index 8a298c5d..b812ffcd 100644
--- a/net/connect.lua
+++ b/net/connect.lua
@@ -56,7 +56,7 @@ function pending_connection_listeners.onconnect(conn)
end
pending_connections_map[conn] = nil;
p:log("debug", "Successfully connected");
- conn:setlistener(p.listeners);
+ conn:setlistener(p.listeners, p.data);
return p.listeners.onconnect(conn);
end
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index 23b3f376..9516ab4d 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -136,10 +136,10 @@ function interface_mt:__tostring()
end
-- Replace the listener and tell the old one
-function interface:setlistener(listeners)
+function interface:setlistener(listeners, data)
self:on("detach");
self.listeners = listeners;
- self:on("attach");
+ self:on("attach", data);
end
-- Call a listener callback
diff --git a/net/server_event.lua b/net/server_event.lua
index 8ee2f28d..9fde558e 100644
--- a/net/server_event.lua
+++ b/net/server_event.lua
@@ -415,7 +415,7 @@ function interface_mt:setoption(option, value)
return false, "setoption not implemented";
end
-function interface_mt:setlistener(listener)
+function interface_mt:setlistener(listener, data)
self:ondetach(); -- Notify listener that it is no longer responsible for this connection
self.onconnect = listener.onconnect;
self.ondisconnect = listener.ondisconnect;
@@ -426,7 +426,7 @@ function interface_mt:setlistener(listener)
self.ondetach = listener.ondetach;
self.onattach = listener.onattach;
self.ondrain = listener.ondrain;
- self:onattach();
+ self:onattach(data);
end
-- Stub handlers
diff --git a/net/server_select.lua b/net/server_select.lua
index 1b535bb7..cd97f0a6 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -321,7 +321,7 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
end
handler.onreadtimeout = onreadtimeout;
- handler.setlistener = function( self, listeners )
+ handler.setlistener = function( self, listeners, data )
if detach then
detach(self) -- Notify listener that it is no longer responsible for this connection
end
@@ -332,7 +332,7 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
handler.onreadtimeout = listeners.onreadtimeout
detach = listeners.ondetach
if listeners.onattach then
- listeners.onattach(self)
+ listeners.onattach(self, data)
end
end
handler.getstats = function( )