Comparison

net/server_event.lua @ 9387:33e52f727f0f

net.connect: Fix passing request table to new listener This could be a return value from ondetach
author Kim Alvefur <zash@zash.se>
date Wed, 26 Sep 2018 17:36:53 +0200
parent 9385:58fe099043ed
child 9473:5fdda751333a
comparison
equal deleted inserted replaced
9386:0f395d82b4ea 9387:33e52f727f0f
413 return self.conn:setoption(option, value); 413 return self.conn:setoption(option, value);
414 end 414 end
415 return false, "setoption not implemented"; 415 return false, "setoption not implemented";
416 end 416 end
417 417
418 function interface_mt:setlistener(listener) 418 function interface_mt:setlistener(listener, data)
419 self:ondetach(); -- Notify listener that it is no longer responsible for this connection 419 self:ondetach(); -- Notify listener that it is no longer responsible for this connection
420 self.onconnect = listener.onconnect; 420 self.onconnect = listener.onconnect;
421 self.ondisconnect = listener.ondisconnect; 421 self.ondisconnect = listener.ondisconnect;
422 self.onincoming = listener.onincoming; 422 self.onincoming = listener.onincoming;
423 self.ontimeout = listener.ontimeout; 423 self.ontimeout = listener.ontimeout;
424 self.onreadtimeout = listener.onreadtimeout; 424 self.onreadtimeout = listener.onreadtimeout;
425 self.onstatus = listener.onstatus; 425 self.onstatus = listener.onstatus;
426 self.ondetach = listener.ondetach; 426 self.ondetach = listener.ondetach;
427 self.onattach = listener.onattach; 427 self.onattach = listener.onattach;
428 self.ondrain = listener.ondrain; 428 self.ondrain = listener.ondrain;
429 self:onattach(); 429 self:onattach(data);
430 end 430 end
431 431
432 -- Stub handlers 432 -- Stub handlers
433 function interface_mt:onconnect() 433 function interface_mt:onconnect()
434 end 434 end