private async Task <BondTcpConnection <TProxy> > RecreateConnection(BondTcpConnection <TProxy> connection) { connection = await m_connectionManager.CreateConnectionAsync(); MarkSuccessOrRecreated(); return(connection); }
public async Task <bool> ConnectAndPinAsync(BondCallTracker callTracker, CancellationToken cancellationToken) { using (await m_connectionSemaphore.AcquireAsync(cancellationToken)) { var connection = m_connection; if (connection == null || ShouldRecreate) { if (m_isDisposed) { return(false); } callTracker.OnStateChanged(BondCallState.RecreateConnection); connection = await RecreateConnection(connection); lock (this) { if (m_isDisposed) { connection.Dispose(); return(false); } m_connection = connection; } } } return(true); }