Fix units

This commit is contained in:
Audrius Butkevicius 2015-10-22 21:40:36 +01:00
parent ce1a5cd2ce
commit c00e26be81
2 changed files with 8 additions and 7 deletions

View File

@ -38,6 +38,7 @@ var (
statusAddr string
poolAddrs string
pools []string
providedBy string
defaultPoolAddrs string = "https://relays.syncthing.net/endpoint"
)
@ -116,7 +117,7 @@ func main() {
go statusService(statusAddr)
}
uri, err := url.Parse(fmt.Sprintf("relay://%s/?id=%s&pingInterval=%s&networkTimeout=%s&sessionLimitBps=%d&globalLimitBps=%d&statusAddr=%s&providedBy=%s", extAddress, id, pingInterval, networkTimeout, sessionLimitBps, globalLimitBps, statusAddr, providedBy))
uri, err := url.Parse(fmt.Sprintf("relay://%s/?id=%s&pingInterval=%s&networkTimeout=%s&sessionLimitBps=%d&globalLimitBps=%d&statusAddr=%s&providedBy=%s", extAddress, id, pingInterval/time.Second, networkTimeout/time.Second, sessionLimitBps, globalLimitBps, statusAddr, providedBy))
if err != nil {
log.Fatalln("Failed to construct URI", err)
}
@ -130,7 +131,7 @@ func main() {
log.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
}
pools := strings.Split(poolAddrs, ",")
pools = strings.Split(poolAddrs, ",")
for _, pool := range pools {
pool = strings.TrimSpace(pool)
if len(pool) > 0 {

View File

@ -26,7 +26,7 @@ func getStatus(w http.ResponseWriter, r *http.Request) {
sessionMut.Lock()
// This can potentially be double the number of pending sessions, as each session has two keys, one for each side.
status["startTime"] = rc.startTime
status["uptime"] = time.Since(rc.startTime)
status["uptimeSeconds"] = time.Since(rc.startTime) / time.Second
status["numPendingSessionKeys"] = len(pendingSessions)
status["numActiveSessions"] = len(activeSessions)
sessionMut.Unlock()
@ -46,12 +46,12 @@ func getStatus(w http.ResponseWriter, r *http.Request) {
rc.rate(60*60/10) * 8 / 1000,
}
status["options"] = map[string]interface{}{
"network-timeout": networkTimeout,
"ping-interval": pingInterval,
"message-timeout": messageTimeout,
"network-timeout": networkTimeout / time.Second,
"ping-interval": pingInterval / time.Second,
"message-timeout": messageTimeout / time.Second,
"per-session-rate": sessionLimitBps,
"global-rate": globalLimitBps,
"pools": defaultPoolAddrs,
"pools": pools,
"provided-by": providedBy,
}