diff options
author | Micael Karlberg <[email protected]> | 2012-01-25 17:56:15 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2012-01-25 17:56:15 +0100 |
commit | e3a9039d7c8f362b00420361a9ed174d0467470e (patch) | |
tree | 9f18ff932a97e69fdc76a97b3a01336f05c2a91b /lib/snmp/src/agent/snmpa_agent.erl | |
parent | e0e862b42d508b5112395f41584bed90c74a8a92 (diff) | |
download | otp-e3a9039d7c8f362b00420361a9ed174d0467470e.tar.gz otp-e3a9039d7c8f362b00420361a9ed174d0467470e.tar.bz2 otp-e3a9039d7c8f362b00420361a9ed174d0467470e.zip |
[snmp/agent] Simultaneous snmpa:backup/1,2 calls interfere
Simultaneous snmpa#backup">snmpa:backup/1,2 calls interfere.
The master agent did not check if a backup was already in
progress when a backup request was accepted
OTP-9884
Diffstat (limited to 'lib/snmp/src/agent/snmpa_agent.erl')
-rw-r--r-- | lib/snmp/src/agent/snmpa_agent.erl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/snmp/src/agent/snmpa_agent.erl b/lib/snmp/src/agent/snmpa_agent.erl index 00fe9be098..e3178aacc6 100644 --- a/lib/snmp/src/agent/snmpa_agent.erl +++ b/lib/snmp/src/agent/snmpa_agent.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -1190,7 +1190,8 @@ handle_call(info, _From, S) -> handle_call(get_net_if, _From, S) -> {reply, get(net_if), S}; -handle_call({backup, BackupDir}, From, S) -> +%% Only accept a backup request if there is none already in progress +handle_call({backup, BackupDir}, From, #state{backup = undefined} = S) -> ?vlog("backup: ~p", [BackupDir]), Pid = self(), V = get(verbosity), @@ -1207,7 +1208,11 @@ handle_call({backup, BackupDir}, From, S) -> end), ?vtrace("backup server: ~p", [BackupServer]), {noreply, S#state{backup = {BackupServer, From}}}; - + +handle_call({backup, _BackupDir}, From, #state{backup = Backup} = S) -> + ?vinfo("backup already in progress: ~p", [Backup]), + {reply, {error, backup_in_progress}, S}; + handle_call(dump_mibs, _From, S) -> Reply = snmpa_mib:dump(get(mibserver)), {reply, Reply, S}; |