samuraisam/pyapns — pull request #26 by endyman (2012-03-09 10:54:04+00:00)
Title: * implemented token blacklisting for invalid apns tokens

Invalid APNS tokens i.e. sandbox tokens will cause Apple to drop the
APNS SSL connection. By using the extended protocol we can provide an
ID with each message and Apple will send a binary notice prior closing
the connection with the token causing the problem and a reason code.
Tokens are stored in a "dict buffer" for later lookup. If a token
causes a connection drop, the token will be added to a global black
list (per appID). Next time the token will be filtered out. This will
at least provide a level of "self-healing" - Next step would be to
expose the black list via XML-RPC so that the client can fetch and de-provision the bad tokens (like
the feedback service data)