Skip to content

Commit

Permalink
Fix for leaking file descriptor issue
Browse files Browse the repository at this point in the history
Add call to stopTrying on the APNSClientFactory (ReconnectingClientFactory) in the timed
disconnect portion of the code.  If this call is not made, the reconnecting code will
reconnect to Apple and the connection is left unreferenced. This can cause an issue
with 'Too many open files'.
  • Loading branch information
Bill Davis committed Nov 11, 2013
1 parent 5376e60 commit 7f813ca
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pyapns/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def write(self, notifications):
if conn_time > MAX_CONNECTION_TIME:
log.msg('APNSService write (disconnecting based on max connection time)')
self.factory.clientProtocol.transport.loseConnection()
self.factory.stopTrying()
self.factory = None

if not self.factory:
Expand Down

0 comments on commit 7f813ca

Please sign in to comment.