Fix suspend stream on opening if no data
cover Fix suspend stream on opening if no data
Hi,
This patch is to suspend obex stream on opening if there is no data available yet to be sent. In such way unnecessary trafic is avoided and IOP is improved with certain headsets. More specifically call histories get requests from BH-902 are fixed.
Br,
Dmitriy
PATCH 1/1 Fix suspend stream on opening if no data
Fix write to stream and suspend it immidiately if there is no data available.
--- src/obex.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
src/obex.c +13 -1
@@ -813,10 +813,22 @@ static void cmd_get(struct obex_session *os, obex_t *obex, obex_object_t *obj) os->obj = obj; os->driver->set_io_watch (os->object, handle_async_io, os);return ; - }else + }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 immidiately +* 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:os_set_response (obj, err);
Signature · 1 line
1.7.0.4
Quoted 2 lines · Dmitriy Paliy
+ /* Try to write to stream and suspend the stream
immidiately
Should be immediately (and in the log message as well)
Hi Dmitriy,
Quoted 5 lines · Dmitriy Paliy
Fix write to stream and suspend it immidiately if there is no data available.
--- src/obex.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
Looks good. The patch has been pushed upstream. Do pay attention to whitespace issues in the future though. I got this when applying it:
Applying: Fix suspend stream on opening if no data /home/jh/src/obexd/.git/rebase-apply/patch:18: trailing whitespace.
warning: 1 line applied after fixing whitespace errors.
This came from the empty line with two tabs after the AddHeader call:
src/obex.c static void cmd_get(struct obex_session *os, obex_t *obex, obex_object_t *obj) · line 820
Quoted 3 lines
src/obex.c +1
-0OBEX_ObjectAddHeader (obex, obj,OBEX_HDR_BODY , hd,0 ,OBEX_FL_STREAM_START ); +
Johan