1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-24 23:26:35 +09:00
This commit is contained in:
syuilo 2019-05-07 18:23:12 +09:00
parent 1448b11d00
commit 70123805e1
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
2 changed files with 3 additions and 2 deletions

View File

@ -200,6 +200,7 @@ export default Vue.extend({
// //
if (this.game.isStarted && !this.game.isEnded) { if (this.game.isStarted && !this.game.isEnded) {
this.pollingClock = setInterval(() => { this.pollingClock = setInterval(() => {
if (this.game.isEnded) return;
const crc32 = CRC32.str(this.logs.map(x => x.pos.toString()).join('')); const crc32 = CRC32.str(this.logs.map(x => x.pos.toString()).join(''));
this.connection.send('check', { this.connection.send('check', {
crc32: crc32 crc32: crc32

View File

@ -302,13 +302,13 @@ export default class extends Channel {
} }
@autobind @autobind
private async check(crc32: string) { private async check(crc32: string | number) {
const game = await ReversiGames.findOne(this.gameId!); const game = await ReversiGames.findOne(this.gameId!);
if (game == null) throw new Error('game not found'); if (game == null) throw new Error('game not found');
if (!game.isStarted) return; if (!game.isStarted) return;
if (crc32 !== game.crc32) { if (crc32.toString() !== game.crc32) {
this.send('rescue', await ReversiGames.pack(game, this.user)); this.send('rescue', await ReversiGames.pack(game, this.user));
} }
} }