Fix fd-leak in rpcClient close it pro-actively.

This commit is contained in:
Harshavardhana
2016-08-28 20:04:47 -07:00
parent 0513b3ed07
commit cbe87cb2ed
3 changed files with 20 additions and 24 deletions

View File

@@ -149,11 +149,14 @@ func (authClient *AuthRPCClient) Call(serviceMethod string, args interface {
args.SetToken(authClient.token)
args.SetTimestamp(authClient.tstamp)
// ..
// Call the underlying rpc.
err = authClient.rpc.Call(serviceMethod, args, reply)
// Invalidate token to mark for re-login on subsequent reconnect.
if err != nil && err == rpc.ErrShutdown {
authClient.isLoggedIn = false
if err != nil {
if err.Error() == rpc.ErrShutdown.Error() {
authClient.isLoggedIn = false
}
}
}
return err