diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-10-04 11:29:03 +0100 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-10-04 11:29:03 +0100 |
commit | e813894056d29bbbfda7905e1e4144ec35abca72 (patch) | |
tree | 93b9f5e0e54389934fcb09678d860b8b04c9f482 | |
parent | 230ee330d2edb37ecb3a8d140753a25b944520da (diff) | |
download | rabbitmq-server-e813894056d29bbbfda7905e1e4144ec35abca72.tar.gz |
both client_terminate and client_delete clear the msg_store's on_disk callbacks
-rw-r--r-- | src/rabbit_msg_store.erl | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index 73565847..1a25e790 100644 --- a/src/rabbit_msg_store.erl +++ b/src/rabbit_msg_store.erl @@ -493,6 +493,13 @@ client_read3(Server, #msg_location { guid = Guid, file = File }, Defer, end end. +clear_client_callback(CRef, + State = #msstate { client_ondisk_callback = CODC, + cref_to_guids = CTG }) -> + State #msstate { client_ondisk_callback = dict:erase(CRef, CODC), + cref_to_guids = dict:erase(CRef, CTG)}. + + %%---------------------------------------------------------------------------- %% gen_server callbacks %%---------------------------------------------------------------------------- @@ -632,11 +639,8 @@ handle_call({new_client_state, CRef, Callback}, _From, handle_call(successfully_recovered_state, _From, State) -> reply(State #msstate.successfully_recovered, State); -handle_call({client_terminate, #client_msstate { client_ref = CRef }}, _From, - State = #msstate { client_ondisk_callback = CODC, - cref_to_guids = CTG }) -> - reply(ok, State #msstate { client_ondisk_callback = dict:erase(CRef, CODC), - cref_to_guids = dict:erase(CRef, CTG)}). +handle_call({client_terminate, #client_msstate { client_ref = CRef }}, _From, State) -> + reply(ok, clear_client_callback(CRef, State)). handle_cast({write, CRef, Guid}, State = #msstate { current_file_handle = CurHdl, @@ -754,10 +758,9 @@ handle_cast({set_maximum_since_use, Age}, State) -> ok = file_handle_cache:set_maximum_since_use(Age), noreply(State); -handle_cast({client_delete, CRef}, - State = #msstate { client_refs = ClientRefs }) -> - noreply( - State #msstate { client_refs = sets:del_element(CRef, ClientRefs) }). +handle_cast({client_delete, CRef}, State = #msstate { client_refs = ClientRefs }) -> + State1 = clear_client_callback(CRef, State), + noreply(State1 #msstate { client_refs = sets:del_element(CRef, ClientRefs) }). handle_info(timeout, State) -> noreply(internal_sync(State)); |