void ClientMain::signalHandler ( int  sign  )  [private]

Definition at line 590 of file ClientMain.cpp.

00590                                                {
00591         enterCriticalSection();
00592         if (working) {
00593                 cout << endl << DateFormater::getDate() << "Sending the server a service cancel because program is being closed..."
00594                                 << endl;
00595                 try {
00596                         bool answerReceived;
00597                         string reason("The client program was closed...");
00598                         ServiceCancel serviceCancel(pServiceOffer->getSessionId(), reason);
00599                         Message response;
00600                         answerReceived = sendAndReceive("main",serviceCancel,response);
00601                         if (answerReceived) {
00602                                 bool found = false;
00603                                 if ( !found ) try {
00604                                         Acknowledgement ack = response;
00605                                         cout << DateFormater::getDate() << "The server accepted our cancelation." << endl;
00606                                         found = true;
00607                                 }
00608                                 catch ( MessageCastException& e ) {}
00609                                 if ( !found ) try {
00610                                         Error err = response;
00611                                         cout << DateFormater::getDate() << "The server detected an error about the service cancel:" << endl;
00612                                         cout << DateFormater::getDate() << err.getReason() << endl;
00613                                         found = true;
00614                                 }
00615                                 catch ( MessageCastException& e ) {}
00616                                 if ( !found ) {
00617                                         cout << DateFormater::getDate() << "Unexpected answer from the server." << endl;
00618                                 }
00619                         }
00620                         else {
00621                                 cout << DateFormater::getDate() << "Can't communicate with server." << endl;
00622                         }
00623                 }
00624                 catch ( NetInterfaceException& e ) {
00625                         cout << DateFormater::getDate() << "Connection failed..." << endl;
00626                         cout << DateFormater::getDate() << "NetInterface: ";
00627                         e.print();
00628                 }
00629         }
00630         leaveCriticalSection();
00631         // the programm exit is not done here, because
00632         // there could be other objects that need to talk
00633         // to the server too...
00634 }


Generated on Wed Jun 25 14:47:08 2008 for keyvil by  doxygen 1.5.1