On Tue, Nov 2, 2010 at 5:25 AM, Radoslaw Jablonski <ext-jablonski.radoslaw@xxxxxxxxx> wrote: > @@ -642,18 +642,39 @@ static int obex_write_stream(struct obex_session *os, > goto add_header; > } > > - len = os->driver->read(os->object, os->buf, os->tx_mtu, &hi); > - if (len < 0) { > - error("read(): %s (%zd)", strerror(-len), -len); > - if (len == -EAGAIN) > - return len; > - else if (len == -ENOSTR) > - return 0; > + /* Copying data from source until we reach end of the stream. Sending > + * data only if MTU will be filled in 100% or we reach end of data. > + * Remaining data in buffer will be sent with next amount of data > + * from source.*/ > + do { > + r_len = os->driver->read(os->object, os->buf + os->pending, > + os->tx_mtu - os->pending, &hi); > > - g_free(os->buf); > - os->buf = NULL; > - return len; > - } > + if (r_len == 0) > + break; > + else if (r_len < 0) { > + error("read(): %s (%zd)", strerror(-r_len), -r_len); > + > + switch(r_len) { Small coding style issue above: a missing space between "switch" and "(". Regards, -- Anderson Lizardo OpenBossa Labs - INdT Manaus - Brazil -- 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