linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Mikel Astiz <mikel.astiz.oss@gmail.com>,
	linux-bluetooth@vger.kernel.org,
	Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: Re: [RFC] media: assertion to check that transport exists
Date: Fri, 16 Dec 2011 14:45:33 -0300	[thread overview]
Message-ID: <20111216174533.GA9701@samus> (raw)
In-Reply-To: <CABBYNZJ9QgLPJQoudjRGZfMF5CHV5LaHUNZf8Hcojh5bjMgaTQ@mail.gmail.com>

Hi Luiz,

On 10:43 Fri 16 Dec, Luiz Augusto von Dentz wrote:
> Hi Mikel,
> 
> On Thu, Dec 15, 2011 at 2:33 PM, Mikel Astiz <mikel.astiz.oss@gmail.com> wrote:
> > From: Mikel Astiz <mikel.astiz@bmw-carit.de>
> >
> > From my understanding, a transport should exist for any non-disconnected
> > gateway.
> >
> > These assertions sometimes fail though. So I would like to clarify if
> > that's a consistent state in BlueZ or there is some bug.
> > ---
> >  audio/media.c |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/audio/media.c b/audio/media.c
> > index a2ef437..c5fe3d9 100644
> > --- a/audio/media.c
> > +++ b/audio/media.c
> > @@ -28,6 +28,7 @@
> >  #endif
> >
> >  #include <errno.h>
> > +#include <assert.h>
> >
> >  #include <glib.h>
> >  #include <gdbus.h>
> > @@ -620,8 +621,10 @@ static void gateway_state_changed(struct audio_device *dev,
> >                                        gateway_setconf_cb, dev, NULL);
> >                break;
> >        case GATEWAY_STATE_CONNECTED:
> > +               assert(endpoint->transport != NULL);
> >                break;
> >        case GATEWAY_STATE_PLAYING:
> > +               assert(endpoint->transport != NULL);
> >                break;
> >        }
> >  }
> > --
> > 1.7.6.4
> 
> IMO assert on daemon are not that great, it may help while developing
> but why not run with valgrind and let it crash?

This information may help with your worries, from the assert(3) man page:
"If the macro NDEBUG was defined at the moment <assert.h> was last included,
the macro assert() generates no code, and hence does nothing at all."

So we can have assert() do something only when it is compiled in developer mode.

> 
> -- 
> Luiz Augusto von Dentz
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers,
-- 
Vinicius

      parent reply	other threads:[~2011-12-16 17:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 12:33 [RFC] media: assertion to check that transport exists Mikel Astiz
2011-12-16  8:43 ` Luiz Augusto von Dentz
2011-12-16 12:06   ` Mikel Astiz
2011-12-16 13:02     ` Luiz Augusto von Dentz
2011-12-16 17:45   ` Vinicius Costa Gomes [this message]

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=20111216174533.GA9701@samus \
    --to=vinicius.gomes@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=mikel.astiz.oss@gmail.com \
    --cc=mikel.astiz@bmw-carit.de \
    /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;
as well as URLs for NNTP newsgroup(s).