Software /
code /
prosody
Comparison
net/server_epoll.lua @ 10280:6b8b255f1d10
net.server_epoll: Add debug logging for various connection events
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 29 Sep 2019 15:02:05 +0200 |
parent | 10279:0e1701197722 |
child | 10282:05ba04725a15 |
comparison
equal
deleted
inserted
replaced
10279:0e1701197722 | 10280:6b8b255f1d10 |
---|---|
628 self:setwritetimeout(cfg.connect_timeout); | 628 self:setwritetimeout(cfg.connect_timeout); |
629 return self:add(true, true); | 629 return self:add(true, true); |
630 end | 630 end |
631 | 631 |
632 function interface:pause() | 632 function interface:pause() |
633 self:debug("Pause reading"); | |
633 return self:set(false); | 634 return self:set(false); |
634 end | 635 end |
635 | 636 |
636 function interface:resume() | 637 function interface:resume() |
638 self:debug("Resume reading"); | |
637 return self:set(true); | 639 return self:set(true); |
638 end | 640 end |
639 | 641 |
640 -- Pause connection for some time | 642 -- Pause connection for some time |
641 function interface:pausefor(t) | 643 function interface:pausefor(t) |
661 self._limit = nil; | 663 self._limit = nil; |
662 end | 664 end |
663 end | 665 end |
664 | 666 |
665 function interface:pause_writes() | 667 function interface:pause_writes() |
668 self:debug("Pause writes"); | |
666 self._write_lock = true; | 669 self._write_lock = true; |
667 self:setwritetimeout(false); | 670 self:setwritetimeout(false); |
668 self:set(nil, false); | 671 self:set(nil, false); |
669 end | 672 end |
670 | 673 |
671 function interface:resume_writes() | 674 function interface:resume_writes() |
675 self:debug("Resume writes"); | |
672 self._write_lock = nil; | 676 self._write_lock = nil; |
673 if self.writebuffer[1] then | 677 if self.writebuffer[1] then |
674 self:setwritetimeout(); | 678 self:setwritetimeout(); |
675 self:set(nil, true); | 679 self:set(nil, true); |
676 end | 680 end |
677 end | 681 end |
678 | 682 |
679 -- Connected! | 683 -- Connected! |
680 function interface:onconnect() | 684 function interface:onconnect() |
685 self:debug("Connected"); | |
681 self:updatenames(); | 686 self:updatenames(); |
682 self.onconnect = noop; | 687 self.onconnect = noop; |
683 self:on("connect"); | 688 self:on("connect"); |
684 end | 689 end |
685 | 690 |
782 return conn; | 787 return conn; |
783 end; | 788 end; |
784 | 789 |
785 -- Dump all data from one connection into another | 790 -- Dump all data from one connection into another |
786 local function link(from, to) | 791 local function link(from, to) |
792 from:debug("Linking to %s", to.id); | |
787 from.listeners = setmetatable({ | 793 from.listeners = setmetatable({ |
788 onincoming = function (_, data) | 794 onincoming = function (_, data) |
789 from:pause(); | 795 from:pause(); |
790 to:write(data); | 796 to:write(data); |
791 end, | 797 end, |