diff --git a/instance.go b/instance.go index 5a445fe..8056d52 100644 --- a/instance.go +++ b/instance.go @@ -28,6 +28,8 @@ type Instance struct { errorCount uint highestId int hostName string + up bool + identified bool impl ServerImplementation lastError *time.Time lastSuccess *time.Time @@ -51,16 +53,14 @@ func NewInstance(hostname string) *Instance { func (i *Instance) setNextCheck(d *time.Duration) { i.Lock() defer i.Unlock() - i.nextCheck = d + then := time.Now().Add(*d) + i.nextCheck = &then } func (i *Instance) dueForCheck() bool { i.Lock() defer i.Unlock() - if i.nextCheck <= time.Now() { - return true - } - return false + return i.nextCheck.Before(time.Now()) } func (i *Instance) detectNodeType() { diff --git a/toot.go b/toot.go index 9fa125a..6ef66e4 100644 --- a/toot.go +++ b/toot.go @@ -5,5 +5,7 @@ package main type Toot struct { } -func NewToot(input []bytes) *Toot { +func NewToot(input []byte) *Toot { + t := new(Toot) + return t }