39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/aerospike/connection/authenticate.rb', line 39
def call(conn, cluster)
command = LoginCommand.new
if cluster.session_valid?
begin
command.authenticate_via_token(conn, cluster)
rescue => ae
cluster.reset_session_info
if ae.is_a?(Exceptions::Aerospike)
if INVALID_SESSION_ERR.include?(ae.result_code)
command.authenticate_new(conn, cluster)
return true
end
end
raise ae
end
else
command.authenticate_new(conn, cluster)
end
true
rescue ::Aerospike::Exceptions::Aerospike
conn.close if conn
raise ::Aerospike::Exceptions::InvalidCredentials
end
|