Skip to content
Browse files

Document quota check bug, 1st draft at a fix

  • Loading branch information...
1 parent 1af5e37 commit a092e855602d7e64e0eeb9d6032298c9e72accde Bjarni R. Einarsson committed
Showing with 8 additions and 7 deletions.
  1. +3 −3 TODO.md
  2. +3 −3 pagekite/pk.py
  3. +2 −1 pagekite/proto/conns.py
View
6 TODO.md
@@ -2,9 +2,9 @@
## Known bugs ##
- * Pagekite.py tries to reregister kites inline which have been rejected,
- which can lead to tunnels getting shut down when the rejection message
- arrives.
+ * PageKite frontends will disconnect tunnels when kites run out of quota.
+ This will hurt Kazz.am, should recheck all kites and only disable out of
+ quota ones, disconnecting only when all run out. Also, UI issues.
* XML-RPC CNAME creation fail
* Signup message weirdness
View
6 pagekite/pk.py
@@ -234,12 +234,12 @@ def _run(self):
nz_quotas = [qp for qp in quotas if qp[0] and qp[0] > 0]
if nz_quotas:
- quota, request = min(nz_quotas)
- conn.quota = [quota, request, time.time()]
+ quota = min(nz_quotas)[0]
+ conn.quota = [quota, [qp[1] for qp in nz_quotas], time.time()]
results.append(('%s-Quota' % prefix, quota))
elif requests:
if not conn.quota:
- conn.quota = [None, requests[0], time.time()]
+ conn.quota = [None, requests, time.time()]
else:
conn.quota[2] = time.time()
View
3 pagekite/proto/conns.py
@@ -152,7 +152,7 @@ def RecheckQuota(self, conns, when=None):
(self.quota[2] < when-900)):
self.quota[2] = when
self.LogDebug('Rechecking: %s' % (self.quota, ))
- conns.auth.check([self.quota[1]], self,
+ conns.auth.check(self.quota[1], self,
lambda r, l: self.QuotaCallback(conns, r, l))
def ProcessAuthResults(self, results, duplicates_ok=False, add_tunnels=True):
@@ -216,6 +216,7 @@ def QuotaCallback(self, conns, results, log_info):
if r[0] in ('X-PageKite-OK', 'X-PageKite-Duplicate'):
return self
+ # Nothing is OK anymore, give up and shut down the tunnel.
self.Log(log_info)
self.LogInfo('Ran out of quota or account deleted, closing tunnel.')
self.Die()

0 comments on commit a092e85

Please sign in to comment.
Something went wrong with that request. Please try again.