00001 /* 00002 * Copyright 2003 Michael A. Marsh, Cornell University. All rights reserved. 00003 * This software is released under the modified BSD license. 00004 * See the file LICENSE in the top-level directory for details. 00005 */ 00006 // 00007 // $Id: ResponseCallback.cc,v 1.3 2004/05/19 15:56:52 mmarsh Exp $ 00008 // 00009 // $Log: ResponseCallback.cc,v $ 00010 // Revision 1.3 2004/05/19 15:56:52 mmarsh 00011 // *** empty log message *** 00012 // 00013 // Revision 1.2 2003/11/04 22:31:49 mmarsh 00014 // *** empty log message *** 00015 // 00016 // 00017 00018 #include "ResponseCallback.h" 00019 #include "StateInfo.h" 00020 #include "ClientActivity.h" 00021 00022 using namespace CODEX_KeyService; 00023 00024 ResponseCallback::ResponseCallback( const unsigned char* seqNum ) 00025 { 00026 memcpy( m_seqNum, seqNum, CODEX_Server::ServerState::nMID ); 00027 } 00028 00029 ResponseCallback::~ResponseCallback() 00030 { 00031 StateInfo* stateInfo = StateInfo::instance(); 00032 if ( NULL != stateInfo ) 00033 { 00034 stateInfo->removeSequenceNumber(m_seqNum); 00035 } 00036 } 00037 00038 void 00039 ResponseCallback::fail() 00040 { 00041 CODEX_Server::ServerState* serverState = 00042 CODEX_Server::ServerState::instance(); 00043 if ( 0 == serverState ) 00044 { 00045 return; 00046 } 00047 00048 StateInfo* stateInfo = StateInfo::instance(); 00049 if ( 0 == stateInfo ) 00050 { 00051 return; 00052 } 00053 00054 CODEX_Events::Activity* act = stateInfo->getActFromSeqNum( m_seqNum ); 00055 if ( 0 != act ) 00056 { 00057 ClientActivity* ca = stateInfo->getClient( act ); 00058 if ( 0 != ca ) 00059 { 00060 // Close the connection. 00061 ca->close(); 00062 } 00063 } 00064 00065 // If there was no failure, then any challenges should already have been 00066 // removed. 00067 serverState->removeChallenge( m_seqNum ); 00068 }
1.4.1