From e80534ff59b2e62a0ddf4359147b81f5ba10de86 Mon Sep 17 00:00:00 2001 From: Tao Liejun Date: Wed, 9 Sep 2009 17:18:49 +0800 Subject: Fix connection ID issue in Obex lib ConnectionID should be consistent in one Obex session. --- obex/javax/obex/ServerOperation.java | 6 +++--- obex/javax/obex/ServerSession.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'obex') diff --git a/obex/javax/obex/ServerOperation.java b/obex/javax/obex/ServerOperation.java index 8710c64..504fe35 100644 --- a/obex/javax/obex/ServerOperation.java +++ b/obex/javax/obex/ServerOperation.java @@ -169,10 +169,10 @@ public final class ServerOperation implements Operation, BaseStream { mHasBody = true; } - if (requestHeader.mConnectionID != null) { + if (mListener.getConnectionId() != -1 && requestHeader.mConnectionID != null) { mListener.setConnectionId(ObexHelper.convertToLong(requestHeader.mConnectionID)); } else { - mListener.setConnectionId(0); + mListener.setConnectionId(1); } if (requestHeader.mAuthResp != null) { @@ -438,7 +438,7 @@ public final class ServerOperation implements Operation, BaseStream { if (body != null) { mHasBody = true; } - if (requestHeader.mConnectionID != null) { + if (mListener.getConnectionId() != -1 && requestHeader.mConnectionID != null) { mListener.setConnectionId(ObexHelper .convertToLong(requestHeader.mConnectionID)); } else { diff --git a/obex/javax/obex/ServerSession.java b/obex/javax/obex/ServerSession.java index 675272d..aca90bb 100644 --- a/obex/javax/obex/ServerSession.java +++ b/obex/javax/obex/ServerSession.java @@ -283,10 +283,10 @@ public final class ServerSession extends ObexSession implements Runnable { ObexHelper.updateHeaderSet(request, headers); - if (request.mConnectionID != null) { + if (mListener.getConnectionId() != -1 && request.mConnectionID != null) { mListener.setConnectionId(ObexHelper.convertToLong(request.mConnectionID)); } else { - mListener.setConnectionId(-1); + mListener.setConnectionId(1); } // the Auth chan is initiated by the server, client sent back the authResp . if (request.mAuthResp != null) { @@ -405,7 +405,7 @@ public final class ServerSession extends ObexSession implements Runnable { ObexHelper.updateHeaderSet(request, headers); } - if (request.mConnectionID != null) { + if (mListener.getConnectionId() != -1 && request.mConnectionID != null) { mListener.setConnectionId(ObexHelper.convertToLong(request.mConnectionID)); } else { mListener.setConnectionId(1); @@ -527,7 +527,7 @@ public final class ServerSession extends ObexSession implements Runnable { ObexHelper.updateHeaderSet(request, headers); } - if (request.mConnectionID != null) { + if (mListener.getConnectionId() != -1 && request.mConnectionID != null) { mListener.setConnectionId(ObexHelper.convertToLong(request.mConnectionID)); } else { mListener.setConnectionId(1); -- cgit v1.1