powered by Jive Software

Why does the address of the openfire session change?

When I tested it, I found that the message package received by openfire, from will be reset to the address of the session. This is normal under normal circumstances. But it seems that the network is not good, or flashing. The address of the session will become wrong. Our business logic is to take the username from from and to. So how should I avoid this wrong session?

Normal session:
session:org.jivesoftware.openfire.session.LocalClientSession@6ce3a12f status: 3 address: username__resource@ip/76i28uw9383 id: 2b7z7u2198 presence:

Error session:
session:org.jivesoftware.openfire.session.LocalClientSession@2e111ce9 status: 1 address: ip/76i28uw9383 id: 1u1myukuo7 presence:

can you explain a bit more to understand?

I am not good at English, I hope you can understand.
The main problem: the message sent from the client, the value in the from field will change in openfire.
For example:

<message type="chat" to="username1@jabber.com" id="97610d5bc" from="username2@jabber.com/76i28uw9383">

Openfire received:
<message type="chat" to="username1@jabber.com" id="97610d5bc" from="jabber.com/76i28uw9383">

In the beginning, I found this piece of code in smack:

    Public void sendPacket(Packet packet) throws NotConnectedException {
        If (!isConnected()) {
            Throw new NotConnectedException();
        If (packet == null) {
            Throw new IllegalArgumentException("Packet must not be null");
        Switch (fromMode) {
        Case OMITTED:
        Case USER:
        Case UNCHANGED:

But later found that openfire source code will also use the address of the session to cover from.
Now I suspect that when the network signal is not good, or when the flash is broken, the session will change, resulting in a message error. It is also possible that the stream is reconnected. Because I can’t simulate a session error, I can’t confirm it. Can you help me?