handleErrorMessage method
Acts on an ErrorMessage the peer sent, for the codes every client answers the same way.
A terminal code refuses the build for good; anything else moves the client to ConnectionStatus.error, and a failed handshake also frees whoever is waiting on it.
A client that has codes of its own handles those first and calls this for the rest, so a terminal code added to Protocol.terminalErrors reaches every client without being wired up twice.
Implementation
@protected
void handleErrorMessage(ErrorMessage message) {
if (SyncIncompatibility.isTerminalCode(message.code)) {
refuseBuild(code: message.code, reason: message.message);
return;
}
updateConnectionStatus(ConnectionStatus.error);
if (message.code == Protocol.errorHandshakeFailed) {
handshake.reset();
}
}