ing
This commit is contained in:
parent
7d2c9c4328
commit
b6d1f49145
|
@ -82,10 +82,6 @@ func (d *ofDiscoverer) Message() <-chan types.DiscoveryMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ofDiscoverer) SendMessage(discoveryRequest types.DiscoveryRequest, messageType types.DiscoveryMessageType, datas ...interface{}) {
|
func (d *ofDiscoverer) SendMessage(discoveryRequest types.DiscoveryRequest, messageType types.DiscoveryMessageType, datas ...interface{}) {
|
||||||
if discoveryRequest.(*ofDiscoveryRequest).canceled.Load().(bool) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
d.messageChan <- types.MakeDiscoveryMessage(discoveryRequest, messageType, datas...)
|
d.messageChan <- types.MakeDiscoveryMessage(discoveryRequest, messageType, datas...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +166,6 @@ LOOP:
|
||||||
case <-time.After(time.Millisecond * 500):
|
case <-time.After(time.Millisecond * 500):
|
||||||
}
|
}
|
||||||
d.SendMessage(req, types.DiscoveryMessageTypeStop, omu.Now())
|
d.SendMessage(req, types.DiscoveryMessageTypeStop, omu.Now())
|
||||||
s.DiscoveryRequest().(*ofDiscoveryRequest).canceled.Store(true)
|
|
||||||
|
|
||||||
if _, ok := d.processingSessions.Load(req.RequestID()); ok {
|
if _, ok := d.processingSessions.Load(req.RequestID()); ok {
|
||||||
d.processingSessions.Delete(req.RequestID())
|
d.processingSessions.Delete(req.RequestID())
|
||||||
|
|
|
@ -2,7 +2,6 @@ package discovery
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
|
||||||
|
|
||||||
"git.loafle.net/overflow_scanner/probe/discovery/types"
|
"git.loafle.net/overflow_scanner/probe/discovery/types"
|
||||||
uuid "github.com/satori/go.uuid"
|
uuid "github.com/satori/go.uuid"
|
||||||
|
@ -14,8 +13,6 @@ type ofDiscoveryRequest struct {
|
||||||
requestType types.DiscoveryRequestType
|
requestType types.DiscoveryRequestType
|
||||||
params []interface{}
|
params []interface{}
|
||||||
|
|
||||||
canceled atomic.Value
|
|
||||||
|
|
||||||
dequeue chan bool
|
dequeue chan bool
|
||||||
timeout bool
|
timeout bool
|
||||||
}
|
}
|
||||||
|
@ -55,7 +52,6 @@ func retainDiscoveryRequest(requesterID string, requestType types.DiscoveryReque
|
||||||
dr.requesterID = requesterID
|
dr.requesterID = requesterID
|
||||||
dr.requestType = requestType
|
dr.requestType = requestType
|
||||||
dr.params = params
|
dr.params = params
|
||||||
dr.canceled.Store(false)
|
|
||||||
dr.dequeue = make(chan bool, 1)
|
dr.dequeue = make(chan bool, 1)
|
||||||
dr.timeout = false
|
dr.timeout = false
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user