public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Daryl Van Vorst" <daryl@wideray.com>
To: "'Marcel Holtmann'" <marcel@holtmann.org>
Cc: "'BlueZ Mailing List'" <bluez-devel@lists.sourceforge.net>
Subject: RE: [Bluez-devel] Rfcomm Use Count
Date: Mon, 20 Sep 2004 11:52:43 -0700	[thread overview]
Message-ID: <002a01c49f43$03879960$1a01010a@baked> (raw)
In-Reply-To: <1095705177.5731.36.camel@pegasus>

Hi Marcel,

> > Making bluez_accept_dequeue() return sockets regardless of=20
> state is a
> > potential solution. Accept() for rfcomm and l2cap would=20
> then need to be
> > modified to kill already closed sockets. The existing loop=20
> in the accept()'s
> > would need to be modified or a new one added to handle
> > bluez_accept_dequeue() not always returning an open socket.
>=20
> I don't like that idea and the problem is not in=20
> ...cleanup_listen() and
> so I am not sure if it will really help us.

Fair enough. Though I'm talking about changing bluez_accept_dequeue(), =
not
necessarily cleanup_listen().

> > I may not have been clear about my thoughts on=20
> rfcomm_sock_cleanup_listen().
> > If bluez_accept_dequeue() did return sockets regardless of=20
> state, then
> > rfcomm_sock_cleanup_listen() should work (unless calling=20
> close on an already
> > closed socket causes trouble). When it calls=20
> rfcomm_sock_kill(), sock_put()
> > gets called which calls destruct() which should decrement=20
> the use count.
>=20
> The ...cleanup_listen() kicks in when you stop the listening=20
> server, but
> that is far too late. The problematic part already happened.=20
> We close a
> connection that wasn't accepted. We must fix it there and not=20
> afterwards
> like somekind of garbage collection. This is the kernel and not some
> weird Jave/C++ code.

With my suggestion above the condition would be handled by either =
accept()
or cleanup_listen(), whichever is called first. Though I guess you could
still consider that to be garbage collection.

> > What if bluez_accept_dequeue() called sk->shutdown() on=20
> sockets which are
> > already closed in the accept queue?
>=20
> I am not sure about the side effects, but this can be a=20
> solution. What I
> think is that setting the socket to BT_CLOSED is wrong. Maybe using
> BT_DISCONN is better, but this involves changing the state machine.

Calling sk->shutdown() is bluez_accept_dequeue() would be virtually the =
same
timing (i.e. garbage collecting likeness) as the suggestion above =
(returning
the closed socket in ...accept_dequeue). It would happen only when =
accept()
or cleanup_listen() are called.

> > I'll try out l2cap later for you. We should see the same thing.
>=20
> I am not sure anymore. Maybe this is only RFCOMM related.

I sent another e-mail a moment ago...  It doesn't happen with l2cap (or =
at
least I wasn't able to get it to happen).

-Daryl.

  reply	other threads:[~2004-09-20 18:52 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-17  0:10 [Bluez-devel] Rfcomm Use Count Daryl Van Vorst
2004-09-17  8:58 ` Marcel Holtmann
2004-09-20 17:58   ` Daryl Van Vorst
2004-09-20 18:32     ` Marcel Holtmann
2004-09-20 18:52       ` Daryl Van Vorst [this message]
2004-09-20 19:48         ` Marcel Holtmann
2004-09-20 20:52           ` Daryl Van Vorst
2004-09-20 18:37     ` Daryl Van Vorst
2004-09-20 19:50       ` Marcel Holtmann
2004-09-20 20:11         ` Daryl Van Vorst
2004-09-20 20:34           ` Marcel Holtmann
2004-09-20 21:03             ` Daryl Van Vorst
2004-09-20 21:28               ` Marcel Holtmann
2004-09-20 22:38                 ` Daryl Van Vorst
2004-09-20 23:33                   ` Marcel Holtmann
2004-09-21 20:14                     ` Daryl Van Vorst
2004-09-21 20:32                       ` Marcel Holtmann
2004-09-21 20:39                         ` Daryl Van Vorst
2004-09-21 21:26                           ` Daryl Van Vorst
2004-09-21 22:07                             ` Marcel Holtmann
2004-09-21 22:26                               ` Marcel Holtmann
2004-09-21 22:44                                 ` Daryl Van Vorst
2004-09-22 11:08                                   ` Marcel Holtmann
2004-09-22 13:53                                     ` Marcel Holtmann
2004-09-22 17:57                                       ` Daryl Van Vorst
2004-09-22 18:12                                         ` Marcel Holtmann
2004-09-22 19:05                                           ` Daryl Van Vorst
2004-09-22 19:33                                             ` Marcel Holtmann
2004-09-22 19:52                                               ` Daryl Van Vorst
2004-09-22 19:57                                                 ` Marcel Holtmann
2004-09-22 20:05                                                   ` Daryl Van Vorst
     [not found]                                       ` <1096471423.20392.444.camel@igno>
2004-10-02  9:26                                         ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2004-09-13 19:06 [Bluez-devel] Rfcomm use count Daryl Van Vorst
2004-09-13 20:48 ` Daryl Van Vorst
2004-09-13 23:54   ` Daryl Van Vorst
2004-09-14  9:18     ` Marcel Holtmann
2004-09-14 21:58       ` Daryl Van Vorst
2004-08-31 22:09 Daryl Van Vorst
2004-09-08 22:48 ` Daryl Van Vorst
2004-09-08 23:10   ` Daryl Van Vorst
2004-09-12 14:15 ` Marcel Holtmann

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='002a01c49f43$03879960$1a01010a@baked' \
    --to=daryl@wideray.com \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=marcel@holtmann.org \
    /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