Fix listen-bucket (Fixes #2942) (#2949)

Don't close socket while re-initializing notify-listeners, as the rpc
client object is shared between notify-listeners and peer clients.

Also, improves SendRPC() readability by using GetPeerClient().
This commit is contained in:
Aditya Manthramurthy
2016-10-16 20:52:10 -07:00
committed by Harshavardhana
parent 334cdb5d64
commit d02cb963d5
4 changed files with 7 additions and 16 deletions

View File

@@ -142,10 +142,6 @@ func (s3p *s3Peers) SendRPC(peers []string, method string, args interface {
SetToken(token string)
SetTimestamp(tstamp time.Time)
}) map[string]error {
// Take read lock for rpcClient map
s3p.mutex.RLock()
defer s3p.mutex.RUnlock()
// Result type
type callResult struct {
target string
@@ -158,9 +154,9 @@ func (s3p *s3Peers) SendRPC(peers []string, method string, args interface {
// Closure to make a single request.
callTarget := func(target string) {
reply := &GenericReply{}
client, ok := s3p.rpcClients[target]
client := s3p.GetPeerClient(target)
var err error
if !ok {
if client == nil {
err = fmt.Errorf("Requested client was not initialized - %v",
target)
} else {