Diff between c3c493f40dfc72137aa3fc9d6e19462fba70ceab and b1c5dee6f47c552d00d2395811619fa1d5858e89

Changed Files

File Additions Deletions Status
obexd/src/obex.c +15 -20 modified

Full Patch

diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index e45ed74..f2a21b7 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -808,30 +808,25 @@ static void cmd_get(struct obex_session *os, obex_t *obex, obex_object_t *obj)
 
 	/* Add body header */
 	hd.bs = NULL;
-	if (os->size == 0)
-		OBEX_ObjectAddHeader (obex, obj, OBEX_HDR_BODY,
-				hd, 0, OBEX_FL_FIT_ONE_PACKET);
-	else if (!stream) {
-		/* Asynchronous operation that doesn't use stream */
+	if (os->size == 0) {
+		OBEX_ObjectAddHeader(obex, obj, OBEX_HDR_BODY, hd, 0,
+						OBEX_FL_FIT_ONE_PACKET);
+		goto done;
+	}
+
+	if (stream)
+		/* Standard data stream */
+		OBEX_ObjectAddHeader(obex, obj, OBEX_HDR_BODY, hd, 0,
+						OBEX_FL_STREAM_START);
+
+	/* Try to write to stream and suspend the stream immediately
+	 * if no data available to send. */
+	err = obex_write_stream(os, obex, obj);
+	if (err == -EAGAIN) {
 		OBEX_SuspendRequest(obex, obj);
 		os->obj = obj;
 		os->driver->set_io_watch(os->object, handle_async_io, os);
 		return;
-	} else {
-		/* Standard data stream */
-		OBEX_ObjectAddHeader (obex, obj, OBEX_HDR_BODY,
-				hd, 0, OBEX_FL_STREAM_START);
-
-		/* Try to write to stream and suspend the stream immediately
-		 * if no data available to send. */
-		err = obex_write_stream(os, obex, obj);
-		if (err == -EAGAIN) {
-			OBEX_SuspendRequest(obex, obj);
-			os->obj = obj;
-			os->driver->set_io_watch(os->object, handle_async_io,
-									os);
-			return;
-		}
 	}
 
 done: