Commit 8c7efbb4 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed routing of IQ errors triggered by IQ packets generted by the server....

Fixed routing of IQ errors triggered by IQ packets generted by the server. Fixes possible memory leak. JM-729

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4076 b35dd754-fafc-0310-a699-88a17e54d16e
parent 5693cc07
...@@ -155,6 +155,9 @@ public class IQRouter extends BasicModule { ...@@ -155,6 +155,9 @@ public class IQRouter extends BasicModule {
* @param listener the IQResultListener that will be invoked when an answer is received * @param listener the IQResultListener that will be invoked when an answer is received
*/ */
public void addIQResultListener(String id, IQResultListener listener) { public void addIQResultListener(String id, IQResultListener listener) {
// TODO Add a check that if no IQ reply was received for a while then an IQ error should
// be generated by the server and simulate like the client sent it. This will let listeners
// react and be removed from the collection
resultListeners.put(id, listener); resultListeners.put(id, listener);
} }
...@@ -319,6 +322,12 @@ public class IQRouter extends BasicModule { ...@@ -319,6 +322,12 @@ public class IQRouter extends BasicModule {
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);
// Check if the server was the sender of the IQ
if (serverName.equals(originalPacket.getFrom().toString())) {
// Just let the IQ router process the IQ error reply
handle(reply);
return;
}
// Locate a route to the sender of the IQ and ask it to process // Locate a route to the sender of the IQ and ask it to process
// the packet. Use the routingTable so that routes to remote servers // the packet. Use the routingTable so that routes to remote servers
// may be found // may be found
......
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