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

Re: [Libvir] PATCH: Process QEMU monitor at startup



On Fri, 2007-03-02 at 15:34 +0000, Daniel P. Berrange wrote:
> On Fri, Mar 02, 2007 at 03:06:56PM +0000, Mark McLoughlin wrote:

> > 
> > 	index() is a bit odd, why not strstr() ?
> 
> Well we're only looking for a single character match - index() is for
> single characters, strstr() is for strings.

	Sorry, strchr() (which is in the C standard itself, whereas index() is
marked legacy in POSIX ... apparently)

> > > +        if (connect(fd, (struct sockaddr*)&addr, sizeof(addr)) == 0)
> > 
> > 	Um, why not bind() (with SO_REUSEADDR)?
> 
> No particular reason - either will work just fine.

	I've never noticed it done with connect() anywhere else, I guess
because you'd have the same obvious race ...

	I dunno, bind() will fail quickly when we probe a port, whereas
connect() will succeed more slowly and cause another context switch etc.
Not a big deal, but ...

Cheers,
Mark.


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