Software /
code /
prosody
Comparison
net/server_epoll.lua @ 10300:78f2a3a9c537
net.server_epoll: Return early when attepting to set write lock state to current state
Reduces needless duplication of work and log messages..
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 05 Oct 2019 15:22:59 +0200 |
parent | 10289:8c59b20f71dc |
child | 10305:2fadbf209678 |
comparison
equal
deleted
inserted
replaced
10299:fd94721186b8 | 10300:78f2a3a9c537 |
---|---|
666 self._limit = nil; | 666 self._limit = nil; |
667 end | 667 end |
668 end | 668 end |
669 | 669 |
670 function interface:pause_writes() | 670 function interface:pause_writes() |
671 if self._write_lock then | |
672 return | |
673 end | |
671 self:debug("Pause writes"); | 674 self:debug("Pause writes"); |
672 self._write_lock = true; | 675 self._write_lock = true; |
673 self:setwritetimeout(false); | 676 self:setwritetimeout(false); |
674 self:set(nil, false); | 677 self:set(nil, false); |
675 end | 678 end |
676 | 679 |
677 function interface:resume_writes() | 680 function interface:resume_writes() |
681 if not self._write_lock then | |
682 return | |
683 end | |
678 self:debug("Resume writes"); | 684 self:debug("Resume writes"); |
679 self._write_lock = nil; | 685 self._write_lock = nil; |
680 if self.writebuffer[1] then | 686 if self.writebuffer[1] then |
681 self:setwritetimeout(); | 687 self:setwritetimeout(); |
682 self:set(nil, true); | 688 self:set(nil, true); |