Fix issues in XmppConnection cleanup on XmppServer side.

https://review.opencontrail.org/#/c/601/

Couple of issues in XmppConnection cleanup have been identified when
trying to stabilize bgp_stress_test and bgp_xmpp_deferq_test:

o LifetimeManager is not used correctly - actor is enqueued to the
manager directly from the ManagedDelete method instead of invoking
the LifetimeActor Delete method. Given the right sequence of events
this causes problems when the connection is deleted from both above
(due to test TearDown) and below (the mock agent bringing down the
session)

o XmppConnections that are rejected during dequeue (because there's
already a connection from same IP) are not tracked properly.  This
causes problems such as deletion of a different incarnation of the
connection (i.e. same IP but not the same data structure).

Both the above result in assertions in the LifetimeActor destructor.

Following fixes have been implemented:

- Modify ManagedDelete to call Delete on the LifetimeActor. Do this
for both XmppClientConnection and XmppServerConnection.
- Introduce RetryDelete method to put the LifetimeActor back on the
LifetimeManager queue so that deletion is attempted again. Use this
rather than calling ManagedDelete when a lightweight dependent gets
cleaned up.
- Maintain an XmppConnectionSet to keep track of deleted connections
in the XmppServer.  If a connection is rejected in DequeueConnection
because there's a pre-existing connection to the same end point, it
it added to the XmppConnectionSet. A connection that's accepted is
inserted into the XmppConnectionMap. It is migrated from the map to
the set when the LifetimeManager invokes Shutdown. A connection is
erased from the set when it's destroyed.
- Change the XmppConnectionMap in XmppServer from boost::ptr_map to
a std::map since former doesn't allow entries to be removed without
destroying them.
- Remove is_deleted_ from XmppConnection and use the LifetimeActor
deleted state instead.
- Modify XmppConnection::Shutdown to be an alias for ManagedDelete.
- Tweak xmpp_server_sm_test to pass cleanly with new cleanup code.
- Make bgp_stress_test use XmppStateMachineTest for shorter timers.

Incidental changes:

- Rename McastTreeManager's MayResumeDelete to RetryDelete.
- Rename DBTable::MayResumeDelete to RetryDelete for consistency.
- Remove assertion in UpdatePeerRefCount as there's a problem with
it. The underlying problem will be debugged and fixed separately.

Change-Id: I1e51772a5532d23f34b7fba6d62058ba501adbe2
Merge "Fix issues in XmppConnection cleanup on XmppServer side."