Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
ace9198a
Commit
ace9198a
authored
Dec 17, 2015
by
Dave Cridland
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #463 from guusdk/OF-1008
OF-1008: Prevent loops of message failure
parents
17006e28
8f515822
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
49 deletions
+38
-49
IQRouter.java
src/java/org/jivesoftware/openfire/IQRouter.java
+15
-25
MessageRouter.java
src/java/org/jivesoftware/openfire/MessageRouter.java
+16
-15
PresenceRouter.java
src/java/org/jivesoftware/openfire/PresenceRouter.java
+7
-9
No files found.
src/java/org/jivesoftware/openfire/IQRouter.java
View file @
ace9198a
...
...
@@ -20,13 +20,6 @@
package
org
.
jivesoftware
.
openfire
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TimerTask
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.dom4j.Element
;
import
org.jivesoftware.openfire.container.BasicModule
;
import
org.jivesoftware.openfire.handler.IQHandler
;
...
...
@@ -43,11 +36,10 @@ import org.jivesoftware.util.TaskEngine;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.xmpp.component.IQResultListener
;
import
org.xmpp.packet.IQ
;
import
org.xmpp.packet.JID
;
import
org.xmpp.packet.Message
;
import
org.xmpp.packet.Packet
;
import
org.xmpp.packet.PacketError
;
import
org.xmpp.packet.*
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* Routes iq packets throughout the server. Routing is based on the recipient
...
...
@@ -468,21 +460,19 @@ public class IQRouter extends BasicModule {
}
/**
* Notification message indicating that a packet has failed to be routed to the rec
e
ipient.
* Notification message indicating that a packet has failed to be routed to the recipient.
*
* @param rec
e
ipient address of the entity that failed to receive the packet.
* @param packet
IQ packet that failed to be sent to the rece
ipient.
* @param recipient address of the entity that failed to receive the packet.
* @param packet
IQ packet that failed to be sent to the rec
ipient.
*/
public
void
routingFailed
(
JID
receipient
,
Packet
packet
)
{
IQ
iq
=
(
IQ
)
packet
;
// 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
if
(
IQ
.
Type
.
result
!=
iq
.
getType
()
&&
IQ
.
Type
.
error
!=
iq
.
getType
())
{
Log
.
info
(
"Packet sent to unreachable address "
+
packet
.
toXML
());
sendErrorPacket
(
iq
,
PacketError
.
Condition
.
service_unavailable
);
}
else
{
Log
.
warn
(
"Error or result packet could not be delivered "
+
packet
.
toXML
());
public
void
routingFailed
(
JID
recipient
,
Packet
packet
)
{
Log
.
debug
(
"IQ sent to unreachable address: "
+
packet
.
toXML
()
);
final
IQ
iq
=
(
IQ
)
packet
;
// 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
if
(
iq
.
isRequest
()
)
{
sendErrorPacket
(
iq
,
PacketError
.
Condition
.
service_unavailable
);
}
}
...
...
src/java/org/jivesoftware/openfire/MessageRouter.java
View file @
ace9198a
...
...
@@ -244,22 +244,23 @@ public class MessageRouter extends BasicModule {
* Notification message indicating that a packet has failed to be routed to the recipient.
*
* @param recipient address of the entity that failed to receive the packet.
* @param packet Message packet that failed to be sent to the recipient.
* @param packet
Message packet that failed to be sent to the recipient.
*/
public
void
routingFailed
(
JID
recipient
,
Packet
packet
)
{
// If message was sent to an unavailable full JID of a user then retry using the bare JID
if
(
serverName
.
equals
(
recipient
.
getDomain
())
&&
recipient
.
getResource
()
!=
null
&&
userManager
.
isRegisteredUser
(
recipient
.
getNode
()))
{
Message
msg
=
(
Message
)
packet
;
if
(
msg
.
getType
().
equals
(
Message
.
Type
.
chat
))
{
routingTable
.
routePacket
(
recipient
.
asBareJID
(),
packet
,
false
);
}
else
{
// Delegate to offline message strategy, which will either bounce or ignore the message depending on user settings.
messageStrategy
.
storeOffline
((
Message
)
packet
);
}
}
else
{
// Just store the message offline
messageStrategy
.
storeOffline
((
Message
)
packet
);
public
void
routingFailed
(
JID
recipient
,
Packet
packet
)
{
log
.
debug
(
"Message sent to unreachable address: "
+
packet
.
toXML
()
);
final
Message
msg
=
(
Message
)
packet
;
if
(
msg
.
getType
().
equals
(
Message
.
Type
.
chat
)
&&
serverName
.
equals
(
recipient
.
getDomain
()
)
&&
recipient
.
getResource
()
!=
null
&&
routingTable
.
hasClientRoute
(
recipient
.
asBareJID
()
)
)
{
// If message was sent to an unavailable full JID of a user then retry using the bare JID.
routingTable
.
routePacket
(
recipient
.
asBareJID
(),
packet
,
false
);
}
else
{
// Delegate to offline message strategy, which will either bounce or ignore the message depending on user settings.
messageStrategy
.
storeOffline
(
(
Message
)
packet
);
}
}
}
src/java/org/jivesoftware/openfire/PresenceRouter.java
View file @
ace9198a
...
...
@@ -31,11 +31,7 @@ import org.jivesoftware.openfire.session.Session;
import
org.jivesoftware.util.LocaleUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.xmpp.packet.JID
;
import
org.xmpp.packet.Message
;
import
org.xmpp.packet.Packet
;
import
org.xmpp.packet.PacketError
;
import
org.xmpp.packet.Presence
;
import
org.xmpp.packet.*
;
/**
* <p>Route presence packets throughout the server.</p>
...
...
@@ -219,12 +215,14 @@ public class PresenceRouter extends BasicModule {
}
/**
* Notification message indicating that a packet has failed to be routed to the rec
e
ipient.
* Notification message indicating that a packet has failed to be routed to the recipient.
*
* @param rec
e
ipient address of the entity that failed to receive the packet.
* @param packet
Presence packet that failed to be sent to the rece
ipient.
* @param recipient address of the entity that failed to receive the packet.
* @param packet
Presence packet that failed to be sent to the rec
ipient.
*/
public
void
routingFailed
(
JID
receipient
,
Packet
packet
)
{
public
void
routingFailed
(
JID
recipient
,
Packet
packet
)
{
Log
.
debug
(
"Presence sent to unreachable address: "
+
packet
.
toXML
()
);
// presence packets are dropped silently
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment