Skip to content

Commit

Permalink
Fix more upload-related buglets
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjarni R. Einarsson committed Jul 22, 2020
1 parent e31e15a commit d55411c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pagekite/pk.py
Original file line number Diff line number Diff line change
Expand Up @@ -3613,7 +3613,6 @@ def ConnectFrontend(self, conns, server):
return tun # False or None

def DisconnectFrontend(self, conns, server):
logging.Log([('disconnect', server)])
kill = []
for bid in conns.tunnels:
for tunnel in conns.tunnels[bid]:
Expand All @@ -3622,6 +3621,7 @@ def DisconnectFrontend(self, conns, server):
kill.append(tunnel)
for tunnel in kill:
if len(list(six.iterkeys(tunnel.users))) < 1:
logging.Log([('disconnect', server)])
tunnel.Die()
return kill and True or False

Expand Down Expand Up @@ -3936,6 +3936,7 @@ def Epoll(self, epoll, waittime):
if c.IsReadable(now):
mask |= select.EPOLLIN
try:
fdc[fd] = fd # Our synthetic events need this
fdc[fd.fileno()] = fd
except socket.error:
# If this fails, then the socket has HUPed, however we need to
Expand All @@ -3952,6 +3953,7 @@ def Epoll(self, epoll, waittime):
except IOError:
try:
epoll.register(fd, mask)
evs.append((fd, select.EPOLLIN)) # We might have missed events
except (IOError, TypeError):
evs.append((fd, select.EPOLLHUP)) # Error == HUP
else:
Expand Down
5 changes: 3 additions & 2 deletions pagekite/proto/conns.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ def Init(self, conns):
self.filters = []
self.ip_limits = None
self.maxread = int(common.MAX_READ_BYTES * common.MAX_READ_TUNNEL_X)
if not self.conns.config.isfrontend:
self.ExtendSSLRetryDelays()

def Cleanup(self, close=True):
if self.users:
Expand Down Expand Up @@ -637,6 +635,9 @@ def HandlePageKiteResponse(self, parse):
def _BackEnd(server, backends, require_all, conns):
"""This is the back-end end of a tunnel."""
self = Tunnel(conns)
if conns and not conns.config.isfrontend:
self.ExtendSSLRetryDelays()

self.backends = backends
self.require_all = require_all
self.server_info[self.S_NAME] = server
Expand Down

0 comments on commit d55411c

Please sign in to comment.