static void SaveYourselfPhase2ReqProc(SmsConn smsConn, SmPointer managerData) { ClientRec *client = (ClientRec *) managerData; if (verbose) { printf ("Client Id = %s, received SAVE YOURSELF PHASE 2 REQUEST\n", client->clientId); } if (!saveInProgress) { /* * If we are not in the middle of a checkpoint (ie. we just * started the client and sent the initial save yourself), just * send the save yourself phase2 now. */ SmsSaveYourselfPhase2 (client->smsConn); } else { ListAddLast (WaitForPhase2List, (char *) client); if (ListCount (WaitForInteractList) > 0 && OkToEnterInteractPhase ()) { LetClientInteract (ListFirst (WaitForInteractList)); } else if (OkToEnterPhase2 ()) { StartPhase2 (); } } }
static void xsmp_save_yourself_phase2 (GsmClient *client) { GsmXSMPClient *xsmp = (GsmXSMPClient *) client; g_debug ("GsmXSMPClient: xsmp_save_yourself_phase2 ('%s')", xsmp->priv->description); SmsSaveYourselfPhase2 (xsmp->priv->conn); }
void KSMServer::completeShutdownOrCheckpoint() { if ( state != Shutdown && state != Checkpoint ) return; for ( KSMClient* c = clients.first(); c; c = clients.next() ) { if ( !c->saveYourselfDone && !c->waitForPhase2 ) return; // not done yet } // do phase 2 bool waitForPhase2 = false; for ( KSMClient* c = clients.first(); c; c = clients.next() ) { if ( !c->saveYourselfDone && c->waitForPhase2 ) { c->waitForPhase2 = false; SmsSaveYourselfPhase2( c->connection() ); waitForPhase2 = true; } } if ( waitForPhase2 ) return; if ( saveSession ) storeSession(); else discardSession(); if ( state == Shutdown ) { bool waitForKNotify = true; if( !kapp->dcopClient()->connectDCOPSignal( "knotify", "", "notifySignal(QString,QString,QString,QString,QString,int,int,int,int)", "ksmserver", "notifySlot(QString,QString,QString,QString,QString,int,int,int,int)", false )) { waitForKNotify = false; } if( !kapp->dcopClient()->connectDCOPSignal( "knotify", "", "playingFinished(int,int)", "ksmserver", "logoutSoundFinished(int,int)", false )) { waitForKNotify = false; } // event() can return -1 if KNotifyClient short-circuits and avoids KNotify logoutSoundEvent = KNotifyClient::event( 0, "exitkde" ); // KDE says good bye if( logoutSoundEvent <= 0 ) waitForKNotify = false; if( waitForKNotify ) { state = WaitingForKNotify; knotifyTimeoutTimer.start( 20000, true ); return; } startKilling(); } else if ( state == Checkpoint ) { for ( KSMClient* c = clients.first(); c; c = clients.next() ) { SmsSaveComplete( c->connection()); } state = Idle; } }