diff options
author | Dan Gudmundsson <[email protected]> | 2010-02-10 15:27:58 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-02-12 10:03:28 +0100 |
commit | a39cf4a324eca0d5ae363350b79f37401c240cb5 (patch) | |
tree | 55734feea48f9287131be21af9f1d0f76a3c4cc2 /lib/ssl/src/ssl_manager.erl | |
parent | 590a06126b813a306455d340f73c88ebfafce29a (diff) | |
download | otp-a39cf4a324eca0d5ae363350b79f37401c240cb5.tar.gz otp-a39cf4a324eca0d5ae363350b79f37401c240cb5.tar.bz2 otp-a39cf4a324eca0d5ae363350b79f37401c240cb5.zip |
Fixed bug file cache bug and improved the error messages.
Diffstat (limited to 'lib/ssl/src/ssl_manager.erl')
-rw-r--r-- | lib/ssl/src/ssl_manager.erl | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/ssl/src/ssl_manager.erl b/lib/ssl/src/ssl_manager.erl index 6b83c2ea46..ff20ee6025 100644 --- a/lib/ssl/src/ssl_manager.erl +++ b/lib/ssl/src/ssl_manager.erl @@ -74,13 +74,11 @@ connection_init(TrustedcertsFile, Role) -> call({connection_init, TrustedcertsFile, Role}). cache_pem_file(File) -> - case ets:lookup(ssl_file_to_ref,File) of - [{_,_,Content}] -> + case ssl_certificate_db:lookup_cached_certs(File) of + [{_,Content}] -> {ok, Content}; [] -> - {ok, Db} = call({cache_pem, File}), - [{_,_,Content}] = ets:lookup(Db,File), - {ok, Content} + call({cache_pem, File}) end. %%-------------------------------------------------------------------- @@ -170,13 +168,14 @@ handle_call({{connection_init, TrustedcertsFile, _Role}, Pid}, _From, session_cache = Cache} = State) -> erlang:monitor(process, Pid), Result = - case (catch ssl_certificate_db:add_trusted_certs(Pid, - TrustedcertsFile, - Db)) of - {ok, Ref} -> - {ok, Ref, Cache}; - Error -> - {error, Error} + try + {ok, Ref} = ssl_certificate_db:add_trusted_certs(Pid, TrustedcertsFile, Db), + {ok, Ref, Cache} + catch + _:{badmatch, Error} -> + {error, Error}; + _E:_R -> + {error, {_R,erlang:get_stacktrace()}} end, {reply, Result, State}; @@ -198,7 +197,9 @@ handle_call({{cache_pem, File},Pid}, _, State = #state{certificate_db = Db}) -> try ssl_certificate_db:cache_pem_file(Pid,File,Db) of Result -> {reply, Result, State} - catch _:Reason -> + catch _:{badmatch, Reason} -> + {reply, Reason, State}; + _:Reason -> {reply, {error, Reason}, State} end; |