X-Git-Url: https://git.sesse.net/?p=remoteglot;a=blobdiff_plain;f=remoteglot.pl;h=35fe887382eaabb2cc0e0dd7be9a8809c9bf4eea;hp=4b674969c204e24c3a575c633cee431fbef4bf42;hb=ce5f6b655d5daa42abb79961aa18cf7b90db1f74;hpb=91dbe2ca651a26bf0859ad191cf270eb13299fe5 diff --git a/remoteglot.pl b/remoteglot.pl index 4b67496..35fe887 100755 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -67,7 +67,7 @@ select(TBLOG); $| = 1; select(STDOUT); -umask 0022; +umask 0022; # analysis.json should not be served to users. # open the chess engine my $engine = open_engine($remoteglotconf::engine_cmdline, 'E1', sub { handle_uci(@_, 1); }); @@ -124,7 +124,7 @@ if (defined($remoteglotconf::server)) { ); } if (defined($remoteglotconf::target)) { - if ($remoteglotconf::target =~ /^http:/) { + if ($remoteglotconf::target =~ /^https?:/) { fetch_pgn($remoteglotconf::target); } elsif (defined($t)) { $t->cmd("observe $remoteglotconf::target"); @@ -533,7 +533,7 @@ sub prettyprint_pv_no_cache { sub prettyprint_pv { my ($pos, @pvs) = @_; - my $cachekey = $pos->{'fen'} . join('', @pvs); + my $cachekey = $pos->fen() . join('', @pvs); if (exists($pos->{'prettyprint_cache'}{$cachekey})) { return @{$pos->{'prettyprint_cache'}{$cachekey}}; } else { @@ -847,6 +847,14 @@ sub output_json { if (defined($remoteglotconf::engine_details)) { $json->{'engine'}{'details'} = $remoteglotconf::engine_details; } + my @grpc_backends = (); + if (defined($remoteglotconf::engine_grpc_backend)) { + push @grpc_backends, $remoteglotconf::engine_grpc_backend; + } + if (defined($remoteglotconf::engine2_grpc_backend)) { + push @grpc_backends, $remoteglotconf::engine2_grpc_backend; + } + $json->{'internal'}{'grpc_backends'} = \@grpc_backends; if (defined($remoteglotconf::move_source)) { $json->{'move_source'} = $remoteglotconf::move_source; } @@ -893,6 +901,7 @@ sub output_json { if (!$historic_json_only && exists($pos_calculating->{'history'})) { my %score_history = (); + local $dbh->{AutoCommit} = 0; my $q = $dbh->prepare('SELECT * FROM scores WHERE id=?'); my $pos = Position->start_pos('white', 'black'); my $halfmove_num = 0; @@ -909,6 +918,7 @@ sub output_json { ($pos) = $pos->make_pretty_move($move); } $q->finish; + $dbh->commit; # If at any point we are missing 10 consecutive moves, # truncate the history there. This is so we don't get into