Add hook to init and listen observatory statuses

This commit is contained in:
世界
2021-09-05 10:47:09 +08:00
parent 390a76ff61
commit 5bf2b31883
2 changed files with 18 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
package observatory
func (o *Observer) UpdateStatus(result *OutboundStatus) {
o.statusLock.Lock()
defer o.statusLock.Unlock()
if location := o.findStatusLocationLockHolderOnly(result.OutboundTag); location != -1 {
o.status[location] = result
} else {
o.status = append(o.status, result)
}
}