summaryrefslogtreecommitdiffstats
path: root/obex/javax/obex/ServerSession.java
diff options
context:
space:
mode:
Diffstat (limited to 'obex/javax/obex/ServerSession.java')
-rw-r--r--obex/javax/obex/ServerSession.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/obex/javax/obex/ServerSession.java b/obex/javax/obex/ServerSession.java
index dcd0ce8..34a75f4 100644
--- a/obex/javax/obex/ServerSession.java
+++ b/obex/javax/obex/ServerSession.java
@@ -47,7 +47,7 @@ import java.io.OutputStream;
public final class ServerSession extends ObexSession implements Runnable {
private static final String TAG = "Obex ServerSession";
- private static final boolean V = ObexHelper.VDBG;
+ private static final boolean V = Log.isLoggable(ObexHelper.LOG_TAG, Log.VERBOSE);
private ObexTransport mTransport;
@@ -175,7 +175,7 @@ public final class ServerSession extends ObexSession implements Runnable {
mInput.read();
}
code = mListener.onAbort(request, reply);
- Log.v(TAG, "onAbort request handler return value- " + code);
+ Log.d(TAG, "onAbort request handler return value- " + code);
code = validateResponseCode(code);
}
sendResponse(code, null);
@@ -195,6 +195,7 @@ public final class ServerSession extends ObexSession implements Runnable {
* @throws IOException if an error occurred at the transport layer
*/
private void handlePutRequest(int type) throws IOException {
+ if (V) Log.v(TAG, "handlePutRequest");
ServerOperation op = new ServerOperation(this, mInput, type, mMaxPacketLength, mListener);
try {
int response = -1;
@@ -206,10 +207,12 @@ public final class ServerSession extends ObexSession implements Runnable {
response = validateResponseCode(mListener.onPut(op));
}
if (response != ResponseCodes.OBEX_HTTP_OK && !op.isAborted) {
+ if (V) Log.v(TAG, "handlePutRequest pre != HTTP_OK sendReply");
op.sendReply(response);
} else if (!op.isAborted) {
// wait for the final bit
while (!op.finalBitSet) {
+ if (V) Log.v(TAG, "handlePutRequest pre looped sendReply");
op.sendReply(ResponseCodes.OBEX_HTTP_CONTINUE);
}
op.sendReply(response);
@@ -220,7 +223,7 @@ public final class ServerSession extends ObexSession implements Runnable {
*internal error should not be sent because server has already replied with
*OK response in "sendReply")
*/
- if(V) Log.d(TAG,"Exception occured - sending OBEX_HTTP_INTERNAL_ERROR reply",e);
+ if(V) Log.w(TAG,"Exception occured - sending OBEX_HTTP_INTERNAL_ERROR reply",e);
if (!op.isAborted) {
sendResponse(ResponseCodes.OBEX_HTTP_INTERNAL_ERROR, null);
}
@@ -241,6 +244,7 @@ public final class ServerSession extends ObexSession implements Runnable {
* @throws IOException if an error occurred at the transport layer
*/
private void handleGetRequest(int type) throws IOException {
+ if (V) Log.v(TAG, "handleGetRequest");
ServerOperation op = new ServerOperation(this, mInput, type, mMaxPacketLength, mListener);
try {
int response = validateResponseCode(mListener.onGet(op));
@@ -263,6 +267,7 @@ public final class ServerSession extends ObexSession implements Runnable {
public void sendResponse(int code, byte[] header) throws IOException {
int totalLength = 3;
byte[] data = null;
+ if (V) Log.v(TAG,"sendResponse code " + code + " header : " + header);
OutputStream op = mOutput;
if (op == null) {
return;
@@ -270,6 +275,7 @@ public final class ServerSession extends ObexSession implements Runnable {
if (header != null) {
totalLength += header.length;
+ if (V) Log.v(TAG, "header != null totalLength = " + totalLength);
data = new byte[totalLength];
data[0] = (byte)code;
data[1] = (byte)(totalLength >> 8);