This commit was merged in pull request #32.
This commit is contained in:
@@ -16,8 +16,9 @@ type candidate struct {
|
||||
|
||||
// Route picks the connection a job for svc goes to, among agents that speak
|
||||
// at least protocol version minProtocol. It returns model.ErrAgentOffline or
|
||||
// model.ErrAgentTooOld (model.ErrAgentTooOldForPinned when minProtocol asks
|
||||
// for a pinned ref) when there is none.
|
||||
// model.ErrAgentTooOld (model.ErrAgentTooOldForSelfUpdate when minProtocol
|
||||
// asks for self-update, model.ErrAgentTooOldForPinned when it asks for a
|
||||
// pinned ref) when there is none.
|
||||
func (h *Hub) Route(svc model.Service, minProtocol int) (model.Route, error) {
|
||||
h.mu.Lock()
|
||||
conns := make([]candidate, 0, len(h.conns))
|
||||
@@ -65,6 +66,9 @@ func route(svc model.Service, conns []candidate, minProtocol int) (model.Route,
|
||||
}
|
||||
}
|
||||
if tooOld {
|
||||
if minProtocol >= protocol.MinSelfUpdateVersion {
|
||||
return model.Route{}, model.ErrAgentTooOldForSelfUpdate
|
||||
}
|
||||
if minProtocol >= protocol.MinPinnedRefVersion {
|
||||
return model.Route{}, model.ErrAgentTooOldForPinned
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user