void Overlay::OnStop() { emit Disconnecting(); foreach(const QSharedPointer<ConnectionAcquirer> &ca, m_con_acquirers) { ca->Stop(); } m_cm->Stop(); }
void SessionFactory::CreateSession(Node *node, const Id &session_id, SessionType type, AuthFactory::AuthType auth_type, const QSharedPointer<KeyShare> &public_keys) { CreateRound cr; switch(type) { case NULL_ROUND: cr = &TCreateRound<NullRound>; break; case SHUFFLE: cr = &TCreateRound<ShuffleRound>; break; case BULK: cr = &TCreateRound<BulkRound>; break; case REPEATING_BULK: cr = &TCreateRound<RepeatingBulkRound>; break; case CSBULK: cr = &TCreateBulkRound<CSBulkRound, NeffKeyShuffleRound>; break; case NEFF_SHUFFLE: cr = &TCreateRound<NeffShuffleRound>; case BLOG_DROP_REACTIVE: cr = TCreateBlogDropRound<Parameters::ParameterType_CppECHashingProduction, NeffShuffleRound, false>; break; case BLOG_DROP_PROACTIVE: cr = TCreateBlogDropRound<Parameters::ParameterType_CppECHashingProduction, NeffShuffleRound, true>; break; default: qFatal("Invalid session type"); } QSharedPointer<IAuthenticate> authe(AuthFactory::CreateAuthenticate( node, auth_type, public_keys)); Session *session = new Session(node->GetGroupHolder(), authe, session_id, node->GetNetwork(), cr); QObject::connect(node->GetOverlay().data(), SIGNAL(Disconnecting()), session, SLOT(CallStop())); QSharedPointer<Session> psession(session); session->SetSharedPointer(psession); node->GetSessionManager().AddSession(psession); psession->SetSink(node->GetSink().data()); if(node->GetPrivateIdentity().GetLocalId() == node->GetGroupHolder()->GetGroup().GetLeader()) { QSharedPointer<IAuthenticator> autho(AuthFactory::CreateAuthenticator( node, auth_type, public_keys)); QSharedPointer<SessionLeader> sl(new SessionLeader( node->GetGroupHolder()->GetGroup(), node->GetPrivateIdentity(), node->GetNetwork(), psession, autho)); node->GetSessionManager().AddSessionLeader(sl); sl->Start(); } else { psession->Start(); } }