Fixed race caused by writing bool &is_duplicate_normal_connection back up call stack across threads. Fixed by using std::atomic<bool> instead.

Passes make ExperRudp and TESTrudp.
2014-03-28 ned: There is a race here when checking on_connection_lost_ for
                validity as LocalFunctorReplacement<OnConnectionLost>::
                ~LocalFunctorReplacement() resets the slot without a mutex.
                I have suppressed this race as it is benign.
Added missing #include.
Fixed race caused by resetting connection manager in dispatcher before
threads currently running inside dispatcher are done.
Rewrote Transport::ConnectToBootstrapEndpoint and Transport::DetectNatType to no longer be racy.
Cleared all remaining easily repeatable races in TESTrudp. We still need to 24 hour soak test to find
any races which only very rarely turn up, but now TESTrudp ought to be far more stable and reliable.
Replaced use of lambda with defaulted argument as MSVC + GCC wouldn't accept it.
Fixed race in my own race fix earlier committed. Sigh.
Replaced shared_ptr(new) construction with make_shared.
Fixed segfault randomly generated in ConnectToBootstrapEndpoint.
Restored some of the locking semantics in ConnectToBootstrapEndpoint from previous code to see if it makes a difference to the segfaults (I see none here after 10x iteration of TESTrouting_api).
Traced backwards through the OnConnectionAdded and OnConnectionLost strand chain and I have no
idea why the mutex fix is necessary. Added note to say so.
Put a TEMPORARY static mutex around Connection::HandleTick() to see what happens on the CI stability.
Replace global static lock on HandleTick with a per-connection mutex + assert if two HandleTicks occur at once.
Added extra wait on active connection count to decrease to BEH_API_Remove and FUNC_API_Send before resetting state for next test. This should fix a persistently recurring race caused by an ongoing graceful connection close in another thread occurring concurrently to the next test beginning.
Merge pull request #1 from maidsafe/master

Merged from trunk