All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. K. Cliburn" <jcliburn@gmail.com>
To: Jarek Poplawski <jarkao2@gmail.com>
Cc: netdev@vger.kernel.org, ian@jeffray.co.uk
Subject: Re: sendfile() behavior while troubleshooting netdevice
Date: Tue, 29 Jul 2008 08:16:52 -0500	[thread overview]
Message-ID: <488F1844.1070005@bellsouth.net> (raw)
In-Reply-To: <20080729093250.GA13365@ff.dom.local>

Hi Jarek,

Jarek Poplawski wrote:
> sfclient.c:
> ...
> 		prev = count;
> 		count += ret;
> 		if (prev == count) {
> 			fprintf(stderr, "error: expected %d, received %d\n",
> 				fsize, count);
> --->			exit(1);
> 		}
> 
> Maybe you could try without this exit if anything comes later?

That's the way I initially had it, but I'd get infinite loops when the 
bytes were lost; no additional bytes ever showed up.  The 'if (prev == 
count)' check was added later, just to kick the thing out of that 
infinite loop.

However, your question made me realize that ret can be -1, and I don't 
want to change 'count' in that case.  Changed to

if (ret > 0)
	count += ret;

Thanks,
Jay

      reply	other threads:[~2008-07-29 13:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-29  0:07 sendfile() behavior while troubleshooting netdevice Jay Cliburn
2008-07-29  0:27 ` Ian Jeffray
2008-07-29  0:52   ` Jay Cliburn
2008-07-29  6:28 ` Evgeniy Polyakov
2008-07-29 13:32   ` J. K. Cliburn
2008-07-29  9:32 ` Jarek Poplawski
2008-07-29 13:16   ` J. K. Cliburn [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=488F1844.1070005@bellsouth.net \
    --to=jcliburn@gmail.com \
    --cc=ian@jeffray.co.uk \
    --cc=jacliburn@bellsouth.net \
    --cc=jarkao2@gmail.com \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.