diff -r fb2c519f85e0 -r 7a45d2ea2f56 localconnectivityservice/dun/utils/src/DunDownstream.cpp --- a/localconnectivityservice/dun/utils/src/DunDownstream.cpp Tue Sep 14 22:59:42 2010 +0300 +++ b/localconnectivityservice/dun/utils/src/DunDownstream.cpp Wed Oct 13 15:32:36 2010 +0300 @@ -222,6 +222,7 @@ iPushData.iDataPusher->StopOneEvent( iBufferPtr ); } iTransferState = EDunStateIdle; + iOperationType = EDunOperationTypeUndefined; FTRACE(FPrint( _L("CDunDownstream::Stop() complete" ))); return KErrNone; } @@ -298,11 +299,13 @@ { case EDunReaderDownstream: iStatus = KRequestPending; + iTransferState = EDunStateTransferring; iNetwork->ReadOneOrMore( iStatus, *iBufferPtr ); SetActive(); FTRACE(FPrint( _L("CDunDownstream::IssueRequest() RComm ReadOneOrMore() requested" ) )); break; case EDunWriterDownstream: + iTransferState = EDunStateTransferring; AddToQueueAndSend( iBufferPtr, this ); break; default: @@ -310,8 +313,6 @@ return KErrGeneral; } - iTransferState = EDunStateTransferring; - FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (Dir=%d) complete" ), iDirection)); return KErrNone; } @@ -374,6 +375,8 @@ // void CDunDownstream::DoCancel() { + FTRACE(FPrint( _L("CDunDownstream::DoCancel()" ))); + FTRACE(FPrint( _L("CDunDownstream::DoCancel() complete" ))); } // --------------------------------------------------------------------------- @@ -407,8 +410,6 @@ FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (continue) complete" ))); return; } - iTransferState = EDunStateIdle; - iOperationType = EDunOperationTypeUndefined; if ( !iPushData.iDataPusher ) { FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (iPushData.iDataPusher not initialized!) complete" ))); @@ -423,7 +424,8 @@ FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (find event)" ))); if ( foundIndex >= 0 ) { - // Restart the reading from Dataport only if in data mode + iTransferState = EDunStateIdle; + iOperationType = EDunOperationTypeUndefined; FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (issue request)" ))); if ( iPushData.iDataMode ) { @@ -443,9 +445,10 @@ { FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeStart()" ))); iPushData.iDataMode = EFalse; - // Now the data mode has ended. - // If read operation then cancel it. - if ( iOperationType == EDunOperationTypeRead ) + // Now the data mode has ended. If read operation then cancel it. + // Check for iTransferState here to minimize logging + if ( iTransferState==EDunStateTransferring && + iOperationType==EDunOperationTypeRead ) { Stop( EFalse ); } @@ -461,8 +464,14 @@ { FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd()" ))); iPushData.iDataMode = ETrue; - // Command mode ends here so start reading from Dataport - iOperationType = EDunOperationTypeRead; - IssueRequest(); + // Command mode ends here so start reading from Dataport only if generic + // transferring state is EDunStateIdle. This is a reduced form of having + // read pending -> reissue not needed OR write pending -> reissue not needed + // (NotifyDataPushComplete() will reissue). + if ( iTransferState == EDunStateIdle ) + { + iOperationType = EDunOperationTypeRead; // just in case + IssueRequest(); + } FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd() complete" ))); }