gochatai/pachi_py/pachi/distributed/protocol.c
/* Process the reply received from a slave machine.
 * Copy the ascii part to reply_buf and insert the binary part
 * (if any) in the receive queue.
 * Return false if ok, true if the slave is out of sync.
 * slave_lock is held on both entry and exit of this function. */
Process the reply received from a slave machine.
Copy the ascii part to reply_buf and insert the binary part
(if any) in the receive queue.
Return false if ok, true if the slave is out of sync.
slave_lock is held on both entry and exit of this function.
Process the reply received from a slave machine . Copy the ascii part to reply_buf and insert the binary part ( if any ) in the receive queue . Return false if ok true if the slave is out of sync . slave_lock is held on both entry and exit of this function .
static bool
process_reply(int reply_id, char *reply, char *reply_buf,
	      void *bin_reply, int bin_size, int *last_reply_id,
	      int *reply_slot, struct slave_state *sstate)
{
	if (*reply != '=') {
		*last_reply_id = -1;
		return true;
	}
	int cmd_id = atoi(gtp_cmd);
	if (reply_id != cmd_id) {
		*last_reply_id = reply_id;
		return true;
	}
	strncpy(reply_buf, reply, CMDS_SIZE);
	if (reply_id != *last_reply_id)
		*reply_slot = reply_count++;
	gtp_replies[*reply_slot] = reply_buf;
	if (bin_size) insert_buf(sstate, bin_reply, bin_size);
	pthread_cond_signal(&reply_cond);
	*last_reply_id = reply_id;
	return false;
}
static bool process_reply ( int reply_id , char * reply , char * reply_buf , void * bin_reply , int bin_size , int * last_reply_id , int * reply_slot , struct slave_state * sstate ) { if ( * reply != ' ' ) { * last_reply_id = -1 ; return true ; } int cmd_id = atoi ( gtp_cmd ) ; if ( reply_id != cmd_id ) { * last_reply_id = reply_id ; return true ; } strncpy ( reply_buf , reply , CMDS_SIZE ) ; if ( reply_id != * last_reply_id ) * reply_slot = reply_count ++ ; gtp_replies [ * reply_slot ] = reply_buf ; if ( bin_size ) insert_buf ( sstate , bin_reply , bin_size ) ; pthread_cond_signal ( & reply_cond ) ; * last_reply_id = reply_id ; return false ; }
Process the reply received from a slave machine.
Process the reply received from a slave machine .
/* Resend everything if slave returned an error. */ /* FIXME: this often results in infinite loops on errors
	 * not caused by syncing. These should be reported from
	 * the distributed engine. */ /* Make sure we are still in sync. cmd_count may have
	 * changed but the reply is valid as long as cmd_id didn't
	 * change (this only occurs for consecutive genmoves). */