Skip to content

Commit

Permalink
Merge pull request #19 from johnnykv/master
Browse files Browse the repository at this point in the history
Make sure subscriptions are sent after reconnects
  • Loading branch information
rep committed May 14, 2013
2 parents aa32f21 + 98f84b0 commit 1014593
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/hpfeeds.py
Expand Up @@ -163,6 +163,7 @@ def connect(self):

def run(self, message_callback, error_callback):
while not self.stopped:
self._subscribe()
while self.connected:
try:
d = self.recv()
Expand Down Expand Up @@ -215,7 +216,11 @@ def subscribe(self, chaninfo):
chaninfo = [chaninfo,]
for c in chaninfo:
self.subscriptions.add(c)

def _subscribe(self):
for c in self.subscriptions:
try:
logger.debug('Sending subscription for {0}.'.format(c))
self.send(msgsubscribe(self.ident, c))
except Disconnect:
self.connected = False
Expand Down

0 comments on commit 1014593

Please sign in to comment.