gochatai/pachi_py/pachi/distributed/protocol.c
/* Minimimal check of slave identity. Close the file if error. */
Minimimal check of slave identity. Close the file if error.
Minimimal check of slave identity . Close the file if error .
static bool
is_pachi_slave(FILE *f, struct in_addr *client)
{
	char buf[1024];
	fputs("name\n", f);
	if (!fgets(buf, sizeof(buf), f)
	    || strncasecmp(buf, "= Pachi", 7)
	    || !fgets(buf, sizeof(buf), f)
	    || strcmp(buf, "\n")) {
		logline(client, "? ", "bad slave\n");
		fclose(f);
		sleep(1); 
		return false;
	}
	return true;
}
static bool is_pachi_slave ( FILE * f , struct in_addr * client ) { char buf [ 1024 ] ; fputs ( " \n " , f ) ; if ( ! fgets ( buf , sizeof ( buf ) , f ) || strncasecmp ( buf , " " , 7 ) || ! fgets ( buf , sizeof ( buf ) , f ) || strcmp ( buf , " \n " ) ) { logline ( client , " " , " \n " ) ; fclose ( f ) ; sleep ( 1 ) ; return false ; } return true ; }
Minimimal check of slave identity.
Minimimal check of slave identity .
// avoid busy loop if error