Commit 551942f6 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Do not reply with an IQ error to an IQ error. JM-890

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5918 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1f2021b7
...@@ -300,7 +300,7 @@ public class IQRouter extends BasicModule { ...@@ -300,7 +300,7 @@ public class IQRouter extends BasicModule {
} }
// If a route to the target address was not found then try to answer a // If a route to the target address was not found then try to answer a
// service_unavailable error code to the sender of the IQ packet // service_unavailable error code to the sender of the IQ packet
if (!handlerFound && IQ.Type.result != packet.getType()) { if (!handlerFound && IQ.Type.result != packet.getType() && IQ.Type.error != packet.getType()) {
sendErrorPacket(packet, PacketError.Condition.service_unavailable); sendErrorPacket(packet, PacketError.Condition.service_unavailable);
} }
} }
...@@ -319,6 +319,10 @@ public class IQRouter extends BasicModule { ...@@ -319,6 +319,10 @@ public class IQRouter extends BasicModule {
private void sendErrorPacket(IQ originalPacket, PacketError.Condition condition) private void sendErrorPacket(IQ originalPacket, PacketError.Condition condition)
throws UnauthorizedException { throws UnauthorizedException {
if (IQ.Type.error == originalPacket.getType()) {
Log.error("Cannot reply an IQ error to another IQ error: " + originalPacket);
return;
}
IQ reply = IQ.createResultIQ(originalPacket); IQ reply = IQ.createResultIQ(originalPacket);
reply.setChildElement(originalPacket.getChildElement().createCopy()); reply.setChildElement(originalPacket.getChildElement().createCopy());
reply.setError(condition); reply.setError(condition);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment