Skip to content

Commit

Permalink
Fixes #6 and #7 - Reconnection now works again
Browse files Browse the repository at this point in the history
  • Loading branch information
st3fan committed Nov 13, 2014
1 parent 240ff40 commit 27cdc48
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions xapsd/apns.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ class APNSProtocol(Protocol):

def connectionMade(self):
log.msg("APNSProtocol.connectionMade")
self.factory.clientConnectionMade(self)
self.factory.clientConnectionMadeCallback(self)

def connectionLost(self, reason):
log.msg("APNSProtocol.connectionLost")
self.factory.clientConnectionLost(self)
self.factory.clientConnectionLostCallback(self, reason)

def dataReceived(self, data):
log.msg("APNSProtocol.dataReceived: " + data.encode("hex"))
Expand Down Expand Up @@ -103,20 +103,20 @@ def buildProtocol(self, address):
return protocol

def clientConnectionLost(self, connector, reason):
log.msg("APNSClientFactory.clientConnectionLost")
log.msg("APNSClientFactory.clientConnectionLost: " + str(reason))
ReconnectingClientFactory.clientConnectionLost(self, connector, reason)

def clientConnectionFailed(self, connector, reason):
log.msg("APNSClientFactory.clientConnectionFailed: " + str(reason))
ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)

def clientConnectionMade(self, client):
log.msg("APNSClientFactory.clientConnectionMade")
def clientConnectionMadeCallback(self, client):
log.msg("APNSClientFactory.clientConnectionMadeCallback")
self.client = client
self.looper.start(2.5)

def clientConnectionLost(self, client):
log.msg("APNSClientConnectionLost")
def clientConnectionLostCallback(self, client, reason):
log.msg("APNSClientFactory.clientConnectionLostCallback")
self.client = None
self.looper.stop()

Expand Down

0 comments on commit 27cdc48

Please sign in to comment.