gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] GTP sometimes fails


From: Paul Pogonyshev
Subject: Re: [gnugo-devel] GTP sometimes fails
Date: Sat, 19 Mar 2005 12:10:14 +0200
User-agent: KMail/1.4.3

Darren Cook wrote:

> > You may want to look at Quarry's (http://home.gna.org/quarry/) way of
> > handling GTP.  It can be used asynchronously and the main program does
> > it that way.  The simple test in `src/gtp/gtp-test.c' demonstrates
> > setting up the pipes, connecting to an engine and printing basic info.
>
> Thanks. I've been studying the code. There were a couple of things I
> wasn't doing (and that oracle.c isn't doing either):
>   1. Set FD_CLOEXEC  [1]
>   2. Closing the unused pipes [2]
>
> But they didn't help. In fact after these changes it always failed on
> the 3rd test, not just sometimes. But I think that was coincidence as it
>  is back to failing only sometimes again.

This probably indicates some problem with your setup since things went
from random failures to determined failures (which are better, in my
opinion.)

> I also noticed you don't seem to have a \n after the commands you send.
> So I tried stripping the \n off in my program, but then nothing works.
> So I guess I'm mis-reading your code and the \n is required?

It is required and my code does send it.  Simply send_to_engine() is
only meant to send a string to engine, it is a communication channel
abstraction level.  It is not meant to modify the `command' string in
any way and the linefeed is already there, see function send_command()
in `gtp-client.c'.

> P.S. You have a few lines like "assert(pipe(engine_in_pipe) == 0);". I
> guess in a test program this is academic and therefore just programmer
> style, but the code won't work with asserts disabled.

Thanks for the spotting!  While they are harmless in `gtp-test.c', I
have found some in ``real code'' and I'm now rewriting them to work with
assertions turned off.  I just got used to assertions too much it seems...

Paul





reply via email to

[Prev in Thread] Current Thread [Next in Thread]