[tor-commits] [atlas/master] Don't break if last_restarted field is missing.
karsten at torproject.org
karsten at torproject.org
Fri Jan 11 10:09:47 UTC 2013
commit 20ee6998c14abe673ddce3b8ed534315c86544b6
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Tue Dec 4 19:09:47 2012 +0100
Don't break if last_restarted field is missing.
The last_restarted field in details documents was changed from required to
optional in March 2012. The reason is that Onionoo might be missing a
server descriptor and cannot learn the relay/bridge restart time without
it. Make sure we don't rely on the field being present.
Fixes #5307.
---
js/models/relay.js | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/js/models/relay.js b/js/models/relay.js
index 3c686fd..c385f95 100644
--- a/js/models/relay.js
+++ b/js/models/relay.js
@@ -144,14 +144,14 @@ define([
relay.dir_port = relay.dir_address ? relay.dir_address.split(":")[1] : 0;
relay.country = relay.country ? relay.country.toLowerCase() : null;
relay.countryname = relay.country ? CountryCodes[relay.country] : null;
- relay.uptime = model.parsedate(relay.last_restarted);
- relay.uptime_hr = relay.uptime.hr;
+ relay.uptime = relay.last_restarted ? model.parsedate(relay.last_restarted) : null;
+ relay.uptime_hr = relay.uptime ? relay.uptime.hr : null;
relay.as_no = relay.as_number;
relay.as_name = relay.as_name;
model.set({badexit: false});
//console.log(relay.uptime.hrfull);
- relay.uptime_hrfull = relay.uptime.hrfull;
- relay.uptime = relay.uptime.millisecs;
+ relay.uptime_hrfull = relay.uptime ? relay.uptime.hrfull : null;
+ relay.uptime = relay.uptime ? relay.uptime.millisecs : null;
var size = ['16x16', '14x16', '8x16'];
relay.flags = model.parseflags(relay.flags, size);
model.set(relay, options);
More information about the tor-commits
mailing list