ing
This commit is contained in:
parent
9a8684e25a
commit
32d1d7f100
|
@ -100,11 +100,11 @@ func (d *ofDiscoverer) enqueue(req *ofDiscoveryRequest) {
|
|||
case <-req.dequeue:
|
||||
case <-time.After(20 * time.Second):
|
||||
req.timeout = true
|
||||
d.SendMessage(req, types.DiscoveryMessageTypeTimeout, omu.Now(), nil)
|
||||
d.SendMessage(req, types.DiscoveryMessageTypeQueueingTimeout, omu.Now(), nil)
|
||||
}
|
||||
}()
|
||||
default:
|
||||
d.SendMessage(req, types.DiscoveryMessageTypeFailedQueueing, omu.Now(), nil)
|
||||
d.SendMessage(req, types.DiscoveryMessageTypeQueueingFailed, omu.Now(), nil)
|
||||
select {
|
||||
case <-time.After(time.Microsecond * 500):
|
||||
}
|
||||
|
@ -131,15 +131,13 @@ LOOP:
|
|||
}
|
||||
req.(*ofDiscoveryRequest).dequeue <- true
|
||||
|
||||
startTime := time.Now()
|
||||
|
||||
d.SendMessage(req, types.DiscoveryMessageTypeStart, omu.Now(), nil)
|
||||
s := session.RetainDiscoverySession()
|
||||
d.discover(req, s)
|
||||
select {
|
||||
case <-time.After(time.Millisecond * 500):
|
||||
}
|
||||
d.SendMessage(req, types.DiscoveryMessageTypeStop, time.Since(startTime).String(), nil)
|
||||
d.SendMessage(req, types.DiscoveryMessageTypeStop, omu.Now(), nil)
|
||||
|
||||
session.ReleaseDiscoverySession(s)
|
||||
req.(*ofDiscoveryRequest).release()
|
||||
|
|
|
@ -5,8 +5,8 @@ type DiscoveryMessageType int
|
|||
const (
|
||||
DiscoveryMessageTypeNone DiscoveryMessageType = iota
|
||||
DiscoveryMessageTypeQueueing
|
||||
DiscoveryMessageTypeFailedQueueing
|
||||
DiscoveryMessageTypeTimeout
|
||||
DiscoveryMessageTypeQueueingFailed
|
||||
DiscoveryMessageTypeQueueingTimeout
|
||||
DiscoveryMessageTypeStart
|
||||
DiscoveryMessageTypeStop
|
||||
DiscoveryMessageTypeError
|
||||
|
|
|
@ -72,26 +72,26 @@ func (s *DiscoveryService) InitService() {
|
|||
"/scanner",
|
||||
)
|
||||
log.Print("Queueing ", data)
|
||||
case types.DiscoveryMessageTypeFailedQueueing:
|
||||
case types.DiscoveryMessageTypeQueueingFailed:
|
||||
s.PubSub.Pub(
|
||||
rpc.MakeRPCMessage(
|
||||
[]string{request.RequesterID()},
|
||||
"DiscoveryService.FailedQueueing",
|
||||
"DiscoveryService.QueueingFailed",
|
||||
[]interface{}{data},
|
||||
),
|
||||
"/scanner",
|
||||
)
|
||||
log.Print("FailedQueueing ", data)
|
||||
case types.DiscoveryMessageTypeTimeout:
|
||||
log.Print("QueueingFailed ", data)
|
||||
case types.DiscoveryMessageTypeQueueingTimeout:
|
||||
s.PubSub.Pub(
|
||||
rpc.MakeRPCMessage(
|
||||
[]string{request.RequesterID()},
|
||||
"DiscoveryService.Timeout",
|
||||
"DiscoveryService.QueueingTimeout",
|
||||
[]interface{}{data},
|
||||
),
|
||||
"/scanner",
|
||||
)
|
||||
log.Print("Timeout ", data)
|
||||
log.Print("QueueingTimeout ", data)
|
||||
case types.DiscoveryMessageTypeError:
|
||||
s.PubSub.Pub(
|
||||
rpc.MakeRPCMessage(
|
||||
|
|
Loading…
Reference in New Issue
Block a user