cmd/swarm/swarm-smoke-pss: close rpc clients

This commit is contained in:
Rafael Matias 2019-03-25 22:56:47 +01:00
parent 0a366c3d40
commit 97be51930c
No known key found for this signature in database
GPG key ID: 1BC39532FB4A2DBD

View file

@ -31,7 +31,6 @@ type pssNode struct {
pubkey string pubkey string
client *rpc.Client client *rpc.Client
deregisterFunc func() deregisterFunc func()
msgC chan pss.APIMsg
} }
type pssSession struct { type pssSession struct {
@ -162,17 +161,21 @@ func pssSetup() *pssSession {
log.Error("error calling host for subscribe", "err", err) log.Error("error calling host for subscribe", "err", err)
continue continue
} }
var dFn = func() {
sub.Unsubscribe()
rpcClient.Close()
}
session.nodes = append(session.nodes, session.nodes = append(session.nodes,
&pssNode{ &pssNode{
hostIdx: i, hostIdx: i,
addr: []byte(addr), addr: []byte(addr),
client: rpcClient, client: rpcClient,
pubkey: pubkey, pubkey: pubkey,
deregisterFunc: sub.Unsubscribe, deregisterFunc: dFn,
}, },
) )
} }
return session return session
} }