Linux bluetooth development
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] L2CAP: ECONNRESET is set for every l2cap	disconnect.
Date: Sat, 31 Mar 2007 15:55:29 +0200	[thread overview]
Message-ID: <1175349329.5815.271.camel@violet> (raw)
In-Reply-To: <20070328152757.62286.qmail@web52302.mail.re2.yahoo.com>

Hi Aarti,

> I am sure if this issue has been discussed before or
> not. 

it hasn't been discussed. I would remember it.

> Is it necessary to the set the struct sock->err value
> to ECONNRESET when l2cap disconnect request is
> received from remote device ?
> 
> l2cap_disconnect_req function sets the error value in
> sock structure by calling l2cap_chan_del(sk,
> ECONNRESET) every time l2cap connection is
> disconnected.

This is actually the correct behavior since the remote side is about to
terminate the connection. There is no more data pending. All data after
this command is invalid anyway.

> This might lead to some loss of data at receiver side
> in case of fast sender and slow receiver. 

This has been always a problem of L2CAP since flow control is missing.

> The sender will send l2cap packets and disconnects. 
> 
> The receiver side will read the packets, but once
> l2cap disconnect is received, even though there is
> data in sk_buff, the bt_sock_recvmsg will return 0 as
> skb_recv_datagram will return NULL. 
> 
> Can we set the value to ECONNRESET only in case of
> error condition and for the normal disconnect set it
> to 0 by calling l2cap_chan_del(sk,0) from
> l2cap_disconnect_req ?
> 
> So if error field is not set in sock structure,
> bt_sock_recvmsg will return data bytes till sk_buff is
> empty and which case 0 will be returned. This will
> prevent any data loss.
> 
> Also if the user wants to know when socket
> disconnected, POLLHUP will be set for sock fd so after
> disconnect happens and there is data to be read both
> POLLHUP and POLLIN will set.
> If we set sock err field then user will not be able to
> retrieve data from sk_buff, even if POLLLIN is set.

Provide a patch and a test program and I will have a look at it.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2007-03-31 13:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-28 15:27 [Bluez-devel] L2CAP: ECONNRESET is set for every l2cap disconnect Aarti Kumar
2007-03-31 13:55 ` Marcel Holtmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-03-28 13:20 [Bluez-devel] hcid returning "Device or resource busy"? Marcel Holtmann
2007-03-28 15:05 ` [Bluez-devel] L2CAP: ECONNRESET is set for every l2cap disconnect Aarti Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1175349329.5815.271.camel@violet \
    --to=marcel@holtmann.org \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox