From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] gatio: do not read if no read_handler
Date: Mon, 10 May 2010 12:48:29 -0500 [thread overview]
Message-ID: <201005101248.29679.denkenz@gmail.com> (raw)
In-Reply-To: <20100510102217.68f925dc@kcaccard-MOBL3>
[-- Attachment #1: Type: text/plain, Size: 1863 bytes --]
Hi Kristen,
> On Mon, 10 May 2010 12:23:04 -0500
>
> Denis Kenzior <denkenz@gmail.com> wrote:
> > Hi Kristen,
> >
> > > On Mon, 10 May 2010 09:11:52 -0500
> > >
> > > Denis Kenzior <denkenz@gmail.com> wrote:
> > > > Hi Kristen,
> > > >
> > > > > If no read_handler specified, leave data alone in case someone
> > > > > else wants to read it.
> > > > > ---
> > > > > gatchat/gatio.c | 4 ++++
> > > > > gatchat/gsmdial.c | 12 ++++--------
> > > > > 2 files changed, 8 insertions(+), 8 deletions(-)
> > > > >
> > > > > diff --git a/gatchat/gatio.c b/gatchat/gatio.c
> > > > > index 61b0260..b4a3806 100644
> > > > > --- a/gatchat/gatio.c
> > > > > +++ b/gatchat/gatio.c
> > > > > @@ -91,6 +91,10 @@ static gboolean received_data(GIOChannel
> > > > > *channel, GIOCondition cond, if (cond & G_IO_NVAL)
> > > > > return FALSE;
> > > > >
> > > > > + /* if nobody wants this data, leave it alone */
> > > > > + if (io->read_handler == NULL)
> > > > > + return TRUE;
> > > > > +
> > > >
> > > > This is a really bad idea, we should never have cases where the read
> > > > handler is unset, and if we do we should end up closing the socket
> > > > when the buffer is full.
> > >
> > > In your implementation of g_at_chat_suspend, you set the read handler
> > > to NULL.
> >
> > Correct, with the intent that someone else sets the read handler (e.g.
> > g_at_ppp)
>
> What if you receive data after the read handler is set to NULL, but before
> someone else sets the read handler? shouldn't we safe guard against that?
>
We do safe guard, once the buffer runs out of space we close the GAtIO.
However, letting GAtIO enter the event-loop (since only then the io watch will
fire) without a read handler is a user error. Having an active GAtIO without a
read handler is useless...
Regards,
-Denis
prev parent reply other threads:[~2010-05-10 17:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-03 22:45 [PATCH] gatio: do not read if no read_handler Kristen Carlson Accardi
2010-05-10 14:11 ` Denis Kenzior
2010-05-10 17:12 ` Kristen Carlson Accardi
2010-05-10 17:23 ` Denis Kenzior
2010-05-10 17:22 ` Kristen Carlson Accardi
2010-05-10 17:48 ` Denis Kenzior [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=201005101248.29679.denkenz@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.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