Improved error handling.
This commit is contained in:
parent
8ec3f8acec
commit
0b26b5cdd5
1 changed files with 11 additions and 9 deletions
|
@ -65,16 +65,18 @@ module Session
|
||||||
session_file = @path + '/' + client_id.to_s + '/session'
|
session_file = @path + '/' + client_id.to_s + '/session'
|
||||||
data = nil
|
data = nil
|
||||||
return if !File.exist? session_file
|
return if !File.exist? session_file
|
||||||
File.open( session_file, 'rb' ) { |file|
|
begin
|
||||||
file.flock( File::LOCK_EX )
|
File.open( session_file, 'rb' ) { |file|
|
||||||
all = file.read
|
file.flock( File::LOCK_EX )
|
||||||
file.flock( File::LOCK_UN )
|
all = file.read
|
||||||
begin
|
file.flock( File::LOCK_UN )
|
||||||
data = Marshal.load( all )
|
data = Marshal.load( all )
|
||||||
rescue
|
}
|
||||||
return
|
rescue Exception => e
|
||||||
end
|
puts "Error reading '#{session_file}':"
|
||||||
}
|
puts e.inspect
|
||||||
|
return
|
||||||
|
end
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue