Re: [gnet-devel] gnet_conn_readn does not read the specified amount of bytes



On Tue, 2009-02-10 at 14:55 +0000, Fred Labrosse wrote:

Hi Fred,

> I just realised that gnet_conn_readn does not necessarily read the
> specified number of bytes. In one case (reproducible) it reads more
> (everything available on the socket) than the specified amount and in
> the following read, reads less than the specified amount (because some
> had been taken by the previous readn).

I'm not sure I follow. Does your callback get called with a sufficient
number of bytes as data in each case, or not? FWIW, I'm not absolutely
certain that reads are performed in the requested chunking in the layers
below GConn (it's all a bit messy), so if you look at the reads with
strace or so you might well find it does things differently.

I'd be a bit surprised if this API didn't work right, since I've used it
heavily in some of my apps and never had any issues reported in this
respect (binary protocols), at least with normal linux desktop systems.


> This is using gnet-2.0.7.  Is 2.0.8 likely to fix the problem?  Unfortunately, 
> installing 2.0.8 is not trivial (I would have to create debian packages cross-
> compiled for an ARM-based platform).  So before attempting it, I would prefer 
> to have some confirmation that this would help.

I don't remember any fixes which might affect this, but it's a good idea
to use 2.0.8 in any case - IIRC there were a few invalid memory accesses
or race conditions in code paths which might be used in this case.

Do you have a test program by any chance? Can you reproduce the issue on
your desktop system?

Cheers
 -Tim




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]