diff -r 8d540f55e491 -r 425d8f4f7fa5 networksecurity/tls/protocol/AlertProtocolEvents.cpp --- a/networksecurity/tls/protocol/AlertProtocolEvents.cpp Wed Sep 01 12:33:58 2010 +0100 +++ b/networksecurity/tls/protocol/AlertProtocolEvents.cpp Wed Sep 15 00:18:51 2010 +0300 @@ -124,6 +124,13 @@ } case KErrSSLAlertCloseNotify: { + if ( iStateMachine->iStatus.Int() == KRequestPending || + iRecordComposer.CurrentPos() != 0 || + iRecordComposer.UserData()!= NULL ) + { + LOG(Log::Printf(_L("Previous data send request is in the pending state"));) + return this; + } //Upon sending the close_notify from server report KErrEof to the application //to be intact with existing behaviour. iStateMachine->SetLastError( KErrEof ); @@ -153,7 +160,6 @@ case KErrCancel: {// A user_canceled alert should be followed by a close_notify alert. So this // event will be the next one to be processed. - iRecordComposer.SetNext( NULL ); iAlertMsg.Append( EAlertWarning ); iAlertMsg.Append( EAlertclose_notify ); iRecordComposer.SetNext( NULL ); @@ -197,14 +203,20 @@ TUint8 alertDesc = alertMsg[1]; LOG(Log::Printf(_L("CRecvAlert::ProcessL(). Alert level = %d"), alertLevel )); LOG(Log::Printf(_L("CRecvAlert::ProcessL(). Alert description = %d"), alertDesc )); - - TRequestStatus* p=&aStatus; - User::RequestComplete( p, KErrNone ); - if ( alertLevel == EAlertWarning ) + + if ( alertLevel == EAlertFatal ) + { + TRequestStatus* p=&aStatus; + User::RequestComplete( p, KErrSSLAlertHandshakeFailure ); + iStateMachine->SetLastError( KErrSSLAlertHandshakeFailure ); + } + else if ( alertLevel == EAlertWarning ) {// In all circumstances, when a warning alert is received, we carry on as normal. // There is no need to set the next event as this will be unchanged from normal // operation. For a Close_notify alert, we must send one in response. // So the next event will be CSendAlert sending a close-notify alert. + TRequestStatus* p=&aStatus; + User::RequestComplete( p, KErrNone ); if ( alertDesc == EAlertclose_notify ) { iStateMachine->SetLastError( KErrSSLAlertCloseNotify );