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(-) diff --git a/src/obex.c b/src/obex.c index c7d0753..71bcba8 100644 --- a/src/obex.c +++ b/src/obex.c @@ -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); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html