void SendToForwarder::AddConnection(UserID userID, const NetworkConnectionPtr& primaryConnection, const NetworkConnectionPtr& secondaryConnection) { primaryConnection->AddListener(MessageID::SendTo, this); secondaryConnection->AddListener(MessageID::SendTo, this); ConnectionInfo newConnection; newConnection.m_primaryConnection = primaryConnection; newConnection.m_secondaryConnection = secondaryConnection; m_connections[userID] = newConnection; }
void SyncManagerImpl::AddConnection(const NetworkConnectionPtr& newConnection) { #if defined(SYNC_DEBUG) LogInfo("%s Adding Connection", m_syncContext->GetLocalUser()->GetName().GetString().c_str()); #endif newConnection->AddListener(m_messageID, this); m_remoteHosts.resize(m_remoteHosts.size() + 1, RemoteSyncPeer()); RemoteSyncPeer& newPeer = m_remoteHosts.back(); newPeer.m_connection = newConnection; // Automatically remove this object as a listener when newPeer is destroyed newPeer.m_listenerReceipt = CreateRegistrationReceipt(newConnection, &NetworkConnection::RemoveListener, m_messageID, this); if (newConnection->IsConnected()) { SendHandshakeMessage(newPeer); } }