diff options
author | Kenneth Lundin <[email protected]> | 2012-03-29 17:16:31 +0200 |
---|---|---|
committer | Kenneth Lundin <[email protected]> | 2012-03-29 17:17:39 +0200 |
commit | 6a3780b940c9406a48df6d55a0623e6d01892ac4 (patch) | |
tree | 358719f79a59d8d58fb3d91dd3effa6d257af533 /lib/asn1/src/asn1_db.erl | |
parent | e1dda02164dfff667c7247502de442195a4b7d42 (diff) | |
parent | f2802b90d02f41079dd7db4e14dbe9b6fea91255 (diff) | |
download | otp-6a3780b940c9406a48df6d55a0623e6d01892ac4.tar.gz otp-6a3780b940c9406a48df6d55a0623e6d01892ac4.tar.bz2 otp-6a3780b940c9406a48df6d55a0623e6d01892ac4.zip |
Merge branch 'kenneth/asn1/integer_range/OTP-9946' into maint
* kenneth/asn1/integer_range/OTP-9946:
replace 5 sec timeout (too short) with monitor in asn1_db requests
Correct handling of INTEGER (1..4 | 8 | 10 | 20)
Diffstat (limited to 'lib/asn1/src/asn1_db.erl')
-rw-r--r-- | lib/asn1/src/asn1_db.erl | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/asn1/src/asn1_db.erl b/lib/asn1/src/asn1_db.erl index 0862ef6e02..843fc66c9c 100644 --- a/lib/asn1/src/asn1_db.erl +++ b/lib/asn1/src/asn1_db.erl @@ -48,11 +48,19 @@ dbstop() -> Resp = req(stop), erase(?MODULE), Resp. %% Internal functions req(Request) -> - get(?MODULE) ! {self(), Request}, - receive {?MODULE, Reply} -> Reply after 5000 -> exit(db_timeout) end. + DbPid = get(?MODULE), + Ref = erlang:monitor(process,DbPid), + get(?MODULE) ! {{Ref, self()}, Request}, + receive + {{Ref,?MODULE}, Reply} -> + erlang:demonitor(Ref,[flush]), + Reply; + {'DOWN',Ref,_,_,Info} -> + exit({db_error,Info}) + end. -reply(From, Response) -> - From ! {?MODULE, Response}. +reply({Ref,From}, Response) -> + From ! {{Ref,?MODULE}, Response}. init(Parent, Includes) -> MRef = erlang:monitor(process, Parent), |