From b366d50971594562859d64c379ada79746fc06e7 Mon Sep 17 00:00:00 2001 From: Hemant Gupta Date: Fri, 28 Aug 2015 15:13:47 +0530 Subject: OBEX: Avoid pre-sending CONTINUE for SRM enabled case Remote Device: LG-G2 as OPP client Use Case: 1) Pair DUT with Remote. 2) Now push the file from Remote. 3) Ignore the incoming request from Remote Failure: RX_Notification lasts only for 10 seconds. Fix: OBEX lib handles a PUT Request case with NO BODY header on server session with CONTINUE response until body is found in request packet from remote. However, this needs to be avoided if SRM is enabled from remote to get proceed transfer authorization from Application layer. Test: Send connection request from remote device and verified that connection is sustainable for 30 seconds until timeout. Bug: 37886388 Change-Id: I1b5bfd65f9023d77850a34bcb08cfbb435e9a474 --- obex/javax/obex/ServerOperation.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'obex') diff --git a/obex/javax/obex/ServerOperation.java b/obex/javax/obex/ServerOperation.java index 56a675acf082..15ea36789e2c 100644 --- a/obex/javax/obex/ServerOperation.java +++ b/obex/javax/obex/ServerOperation.java @@ -195,7 +195,12 @@ public final class ServerOperation implements Operation, BaseStream { if(!handleObexPacket(packet)) { return; } - if (!mHasBody) { + /* Don't Pre-Send continue when Remote requested for SRM + * Let the Application confirm. + */ + if (V) Log.v(TAG, "Get App confirmation if SRM ENABLED case: " + mSrmEnabled + + " not hasBody case: " + mHasBody); + if (!mHasBody && !mSrmEnabled) { while ((!mGetOperation) && (!finalBitSet)) { sendReply(ResponseCodes.OBEX_HTTP_CONTINUE); if (mPrivateInput.available() > 0) { @@ -204,8 +209,13 @@ public final class ServerOperation implements Operation, BaseStream { } } } - - while ((!mGetOperation) && (!finalBitSet) && (mPrivateInput.available() == 0)) { + /* Don't Pre-Send continue when Remote requested for SRM + * Let the Application confirm. + */ + if (V) Log.v(TAG, "Get App confirmation if SRM ENABLED case: " + mSrmEnabled + + " not finalPacket: " + finalBitSet + " not GETOp Case: " + mGetOperation); + while ((!mSrmEnabled) && (!mGetOperation) && (!finalBitSet) + && (mPrivateInput.available() == 0)) { sendReply(ResponseCodes.OBEX_HTTP_CONTINUE); if (mPrivateInput.available() > 0) { break; -- cgit v1.2.3