Skip to content
Snippets Groups Projects
Commit 51723c5d authored by Hans Moog's avatar Hans Moog
Browse files

Refactor: made request processor use timeutils

parent 0e840e1d
Branches
Tags
No related merge requests found
...@@ -3,6 +3,8 @@ package protocol ...@@ -3,6 +3,8 @@ package protocol
import ( import (
"time" "time"
"github.com/iotaledger/goshimmer/packages/timeutil"
"github.com/iotaledger/goshimmer/packages/accountability" "github.com/iotaledger/goshimmer/packages/accountability"
"github.com/iotaledger/goshimmer/packages/daemon" "github.com/iotaledger/goshimmer/packages/daemon"
"github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/packages/node"
...@@ -41,11 +43,7 @@ func createOutgoingRequestProcessor(plugin *node.Plugin) func() { ...@@ -41,11 +43,7 @@ func createOutgoingRequestProcessor(plugin *node.Plugin) func() {
func sendOutgoingRequests(plugin *node.Plugin) { func sendOutgoingRequests(plugin *node.Plugin) {
for _, chosenNeighborCandidate := range chosenneighbors.CANDIDATES.Clone() { for _, chosenNeighborCandidate := range chosenneighbors.CANDIDATES.Clone() {
select { timeutil.Sleep(5 * time.Second)
case <-daemon.ShutdownSignal:
return
case <-time.After(5 * time.Second):
}
if candidateShouldBeContacted(chosenNeighborCandidate) { if candidateShouldBeContacted(chosenNeighborCandidate) {
if dialed, err := chosenNeighborCandidate.Send(outgoingrequest.INSTANCE.Marshal(), types.PROTOCOL_TYPE_TCP, true); err != nil { if dialed, err := chosenNeighborCandidate.Send(outgoingrequest.INSTANCE.Marshal(), types.PROTOCOL_TYPE_TCP, true); err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment