Check for error when sending RPC byte

This commit is contained in:
Armon Dadgar 2014-01-10 12:09:19 -08:00
parent d741a999f5
commit 786755ebcd
1 changed files with 5 additions and 1 deletions

View File

@ -80,6 +80,10 @@ func (l *RaftLayer) Dial(address string, timeout time.Duration) (net.Conn, error
}
// Write the Raft byte to set the mode
conn.Write([]byte{byte(rpcRaft)})
_, err = conn.Write([]byte{byte(rpcRaft)})
if err != nil {
conn.Close()
return nil, err
}
return conn, err
}