networksecurity/tls/protocol/tlsconnection.cpp
branchRCL_3
changeset 67 bb2423252ea3
parent 63 425d8f4f7fa5
child 75 c1029e558ef5
equal deleted inserted replaced
63:425d8f4f7fa5 67:bb2423252ea3
    53   	LOG(Log::Printf(_L("RHeap::Size(), RHeap::Size() - RHeap::Available() %d, %d"), User::Heap().Size(), User::Heap().Size() - User::Heap().Available( nBlock ) );)
    53   	LOG(Log::Printf(_L("RHeap::Size(), RHeap::Size() - RHeap::Available() %d, %d"), User::Heap().Size(), User::Heap().Size() - User::Heap().Available( nBlock ) );)
    54 #endif
    54 #endif
    55 
    55 
    56 	CleanupStack::PushL(self);
    56 	CleanupStack::PushL(self);
    57 	self->ConstructL(aSocket, aProtocol);
    57 	self->ConstructL(aSocket, aProtocol);
    58 	CleanupStack::Pop();
    58 	CleanupStack::Pop(self);
    59 	return self;
    59 	return self;
    60 }
    60 }
    61 
    61 
    62 EXPORT_C MSecureSocket* CTlsConnection::NewL(MGenericSecureSocket& aSocket, const TDesC& aProtocol)
    62 EXPORT_C MSecureSocket* CTlsConnection::NewL(MGenericSecureSocket& aSocket, const TDesC& aProtocol)
    63 /**
    63 /**
    78   	LOG(Log::Printf(_L("RHeap::Size(), RHeap::Size() - RHeap::Available() %d, %d"), User::Heap().Size(), User::Heap().Size() - User::Heap().Available( nBlock ) );)
    78   	LOG(Log::Printf(_L("RHeap::Size(), RHeap::Size() - RHeap::Available() %d, %d"), User::Heap().Size(), User::Heap().Size() - User::Heap().Available( nBlock ) );)
    79 #endif
    79 #endif
    80 
    80 
    81 	CleanupStack::PushL(self);
    81 	CleanupStack::PushL(self);
    82 	self->ConstructL(aSocket, aProtocol);
    82 	self->ConstructL(aSocket, aProtocol);
    83 	CleanupStack::Pop();
    83 	CleanupStack::Pop(self);
    84 	return self;
    84 	return self;
    85 }
    85 }
    86 
    86 
    87 EXPORT_C void CTlsConnection::UnloadDll(TAny* /*aPtr*/)
    87 EXPORT_C void CTlsConnection::UnloadDll(TAny* /*aPtr*/)
    88 /**
    88 /**
  1242 	   if ( iHandshake != aStateMachine )
  1242 	   if ( iHandshake != aStateMachine )
  1243 	      {
  1243 	      {
  1244 		   return EFalse;
  1244 		   return EFalse;
  1245 	      }
  1245 	      }
  1246       else
  1246       else
  1247          {//delete data path in case it's re-negotiation what's failed
  1247          {
  1248          delete iSendAppData;
  1248 		 //We came here since tls handshake failed for some reasons.
  1249          iSendAppData = NULL;
  1249          //Attempting to delete the application data state machines here,
  1250          delete iRecvAppData;
  1250          //leads to sending incorrect status to the caller application.
  1251          iRecvAppData = NULL;
  1251          //Allow the cleanup of handshake statemachine to continue here.
  1252          ResetCryptoAttributes();
  1252          //Let the application data state machines be cleaned up by the 
       
  1253          //tlsconnection desctructor function.
       
  1254          
       
  1255          //delete iSendAppData;
       
  1256          //iSendAppData = NULL;
       
  1257          //delete iRecvAppData;
       
  1258          //iRecvAppData = NULL;
       
  1259          //ResetCryptoAttributes();
  1253          }
  1260          }
  1254    }
  1261    }
  1255    else
  1262    else
  1256    {//from now on we propose the alrady negotiated protocol untill the connection is closed
  1263    {//from now on we propose the alrady negotiated protocol untill the connection is closed
  1257       iTlsProvider->Attributes()->iProposedProtocol = iTlsProvider->Attributes()->iNegotiatedProtocol;
  1264       iTlsProvider->Attributes()->iProposedProtocol = iTlsProvider->Attributes()->iNegotiatedProtocol;
  1361 		//and wait for re-negotiation to finish (see CTlsConnection::OnCompletion)
  1368 		//and wait for re-negotiation to finish (see CTlsConnection::OnCompletion)
  1362 	}
  1369 	}
  1363 	else
  1370 	else
  1364 	{	
  1371 	{	
  1365 		iRecordComposer->SetUserData( (TDesC8*)&aDesc );
  1372 		iRecordComposer->SetUserData( (TDesC8*)&aDesc );
  1366    	iRecordComposer->ResetCurrentPos();
  1373 		iRecordComposer->ResetCurrentPos();
  1367 		iSendAppData->Start( &aStatus, this );
  1374 		iSendAppData->Start( &aStatus, this );
  1368 	}
  1375 	}
  1369 	
  1376 	
  1370 	return ETrue;
  1377 	return ETrue;
  1371 }
  1378 }