|
@ -14,6 +14,14 @@ import ( |
|
|
func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServer) error { |
|
|
func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServer) error { |
|
|
var dn *topology.DataNode |
|
|
var dn *topology.DataNode |
|
|
t := ms.Topo |
|
|
t := ms.Topo |
|
|
|
|
|
|
|
|
|
|
|
defer func() { |
|
|
|
|
|
if dn != nil { |
|
|
|
|
|
glog.V(0).Infof("unregister disconnected volume server %s:%d", dn.Ip, dn.Port) |
|
|
|
|
|
t.UnRegisterDataNode(dn) |
|
|
|
|
|
} |
|
|
|
|
|
}() |
|
|
|
|
|
|
|
|
for { |
|
|
for { |
|
|
heartbeat, err := stream.Recv() |
|
|
heartbeat, err := stream.Recv() |
|
|
if err == nil { |
|
|
if err == nil { |
|
@ -59,10 +67,6 @@ func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
if dn != nil { |
|
|
|
|
|
glog.V(0).Infof("lost volume server %s:%d", dn.Ip, dn.Port) |
|
|
|
|
|
t.UnRegisterDataNode(dn) |
|
|
|
|
|
} |
|
|
|
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -78,6 +82,7 @@ func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// KeepConnected keep a stream gRPC call to the master. Used by filer to know the master is up.
|
|
|
func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServer) error { |
|
|
func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServer) error { |
|
|
for { |
|
|
for { |
|
|
_, err := stream.Recv() |
|
|
_, err := stream.Recv() |
|
|