Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Commit ebab145

Browse files
committed
quit emit funciton on r.quit
1 parent 7734d31 commit ebab145

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

swarm/network/stream/stream.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ func NewRegistry(localID enode.ID, delivery *Delivery, netStore *storage.NetStor
249249
func (r *Registry) emitPeriodicSubscriptionMetrics() {
250250
for {
251251
select {
252+
case <-r.quit:
253+
return
252254
case <-time.After(10 * time.Second):
253255
var clientStreams int64
254256
var serverStreams int64

swarm/network/stream/streamer_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,8 +1123,8 @@ func TestRequestPeerSubscriptions(t *testing.T) {
11231123
}
11241124
}
11251125

1126-
// TestGetSubscriptions is a unit test for the api.GetPeerServerSubscriptions() function
1127-
func TestGetSubscriptions(t *testing.T) {
1126+
// TestGetServerSubscriptions is a unit test for the api.GetPeerServerSubscriptions() function
1127+
func TestGetServerSubscriptions(t *testing.T) {
11281128
// create an amount of dummy peers
11291129
testPeerCount := 8
11301130
// every peer will have this amount of dummy servers
@@ -1175,11 +1175,11 @@ func TestGetSubscriptions(t *testing.T) {
11751175
}
11761176

11771177
/*
1178-
TestGetSubscriptionsRPC sets up a simulation network of `nodeCount` nodes,
1178+
TestGetServerSubscriptionsRPC sets up a simulation network of `nodeCount` nodes,
11791179
starts the simulation, waits for SyncUpdateDelay in order to kick off
11801180
stream registration, then tests that there are subscriptions.
11811181
*/
1182-
func TestGetSubscriptionsRPC(t *testing.T) {
1182+
func TestGetServerSubscriptionsRPC(t *testing.T) {
11831183

11841184
if testutil.RaceEnabled && os.Getenv("TRAVIS") == "true" {
11851185
t.Skip("flaky with -race on Travis")

0 commit comments

Comments
 (0)