dana-i2cat/opennaas — pull request #89 by isartcanyameres (2012-03-28 16:23:35+00:00)
Title: Feature/one context per protocol

OPENNAAS-248

Destroy sessions using a context when it is unregistered.

Adding a protocol context for a resource is available in any stage of the resource, through protocols:context shell command.
Adding the protocol context actually replaces current context (if any) with the given one.
However, existing sessions, using removed context, are not being removed.

This may leads to a situation with many unused ProtocolSessions. Worst, these sessions may remain connected to a physical device.

This patch causes deletion of existing sessions when unregistering their context,
and forces unregistration of current context before adding the new one.