SignalR/SignalR — pull request #574 by NTaylorMullen (2012-08-02 17:44:13+00:00)
Title: Registered Disconnects for LongPolling and added disconnect logic to limit number of disconnect handles being stored (memory leak).

The #511 fix was being caused by LongPolling never
RegisteringForDisconnect. This was because the invocation was being
called in the DoWriteAsync method iwthin the HttpListenerResponseWrapper
when LongPolling only uses the DoWrite piece. Moving the invocation to
the DoWrite Segment (aka the catch all for writes) fixed the issue.

The Memory leak resulted from multiple requests being called and each
registering for disconnects. For instance, if using LongPolling
transport and user sends 100 messages there was be 102 disconnect
callbacks, 100 for the messages and 2 for the 2 connection streams.
This was fixed by re-doing how the cancellation token process was built.
Added CancellationTokenResolver whos responsibility is to manage a 1 to
1 relationship between cancellation tokens and connection id's instead
of a 1 to many.