display current-version-is-different even when erroring out

This commit is contained in:
Brian Warner 2015-04-09 12:35:07 -07:00
parent e881d169a6
commit 5ff59c92e0

View File

@ -99,19 +99,17 @@ class Common:
version_warning_displayed = False version_warning_displayed = False
def handle_welcome(self, welcome): def handle_welcome(self, welcome):
if "error" in welcome: # Only warn if we're running a release version (e.g. 0.0.6, not
raise ServerError(welcome["error"], self.relay) # 0.0.6-DISTANCE-gHASH). Only warn once.
if "-" in __version__: if ("-" not in __version__ and
# only warn if we're running a release version (e.g. 0.0.6, not not self.version_warning_displayed and
# 0.0.6-DISTANCE-gHASH) welcome["current_version"] != __version__):
return
if self.version_warning_displayed:
return
if welcome["current_version"] != __version__:
print("Warning: errors may occur unless both sides are running the same version", file=sys.stderr) print("Warning: errors may occur unless both sides are running the same version", file=sys.stderr)
print("Server claims %s is current, but ours is %s" print("Server claims %s is current, but ours is %s"
% (welcome["current_version"], __version__), file=sys.stderr) % (welcome["current_version"], __version__), file=sys.stderr)
self.version_warning_displayed = True self.version_warning_displayed = True
if "error" in welcome:
raise ServerError(welcome["error"], self.relay)
def get(self, old_msgs, verb, msgnum): def get(self, old_msgs, verb, msgnum):
# For now, server errors cause the client to fail. TODO: don't. This # For now, server errors cause the client to fail. TODO: don't. This