diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index e85d782d8a..b37d71f218 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -1075,6 +1075,10 @@ sub send_buffered_xml_files ($;$) {
 				unlink ("$temporal_file/$xml_file");	
 			}
 		}
+		# Do not get stuck trying to send buffered XML files to a secondary server.
+		elsif ($flag_always == 2) {
+			last;
+		}
 	}
 	if (defined($flag_always) && ($flag_always == 2)){
 		swap_servers ();