1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-28 23:12:06 +01:00
Commit graph

5162 commits

Author SHA1 Message Date
Florian Schmaus
dee34b5efc [core] Add InternetAddress.fromIgnoringZoneId(String) 2023-02-12 16:06:53 +01:00
Florian Schmaus
6a90300ef6
Merge pull request #550 from Flowdalic/break-loop-in-webscoket-disconnect
[websocket-java11] Prevent infinite recursion in disconnect()
2023-02-11 15:18:29 +00:00
Florian Schmaus
507345ed7a
Merge pull request #549 from Flowdalic/sinttest-uncon-con-source
[sinttest] Add UnconnectedConnectionSource for low-level tests
2023-02-11 15:18:24 +00:00
Florian Schmaus
324e54b81b [websocket-java11] Prevent infinite recursion in disconnect()
Guus reports the following infinite recursing causing a
StackOverflowError:

Exception in thread "main" java.lang.StackOverflowError
	at org.jivesoftware.smack.websocket.java11.Java11WebSocket.disconnect(Java11WebSocket.java:142)
	at org.jivesoftware.smack.websocket.XmppWebSocketTransportModule$XmppWebSocketTransport.disconnect(XmppWebSocketTransportModule.java:265)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection$CloseConnectionState.transitionInto(ModularXmppClientToServerConnection.java:1086)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.attemptEnterState(ModularXmppClientToServerConnection.java:472)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.walkStateGraphInternal(ModularXmppClientToServerConnection.java:399)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.walkStateGraph(ModularXmppClientToServerConnection.java:339)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.shutdown(ModularXmppClientToServerConnection.java:551)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.instantShutdown(ModularXmppClientToServerConnection.java:530)
	at org.jivesoftware.smack.AbstractXMPPConnection.notifyConnectionError(AbstractXMPPConnection.java:1024)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.access$100(ModularXmppClientToServerConnection.java:134)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection$1.notifyConnectionError(ModularXmppClientToServerConnection.java:185)
	at org.jivesoftware.smack.websocket.impl.AbstractWebSocket.onWebSocketFailure(AbstractWebSocket.java:128)
	at org.jivesoftware.smack.websocket.java11.Java11WebSocket.onWebSocketFailure(Java11WebSocket.java:162)
	at org.jivesoftware.smack.websocket.java11.Java11WebSocket.disconnect(Java11WebSocket.java:146)
	at org.jivesoftware.smack.websocket.XmppWebSocketTransportModule$XmppWebSocketTransport.disconnect(XmppWebSocketTransportModule.java:265)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection$CloseConnectionState.transitionInto(ModularXmppClientToServerConnection.java:1086)
	at org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.attemptEnterState(ModularXmppClientToServerConnection.java:472)
...

This is because sendClose() in Java11WebSocket.disconnect() throws,
potentially because the output stream is already closed. We previously
would feed the exception into the onWebSocketFailure(Exception)
machinery, which would then again attempt a disconnect.

Since a failed sendClose() is nothing that needs special handling, we
simply log the exception as error. Furthermore, we only issue
sendClose() if the WebSocket's output is still open, i.e., if there is
a chance that it actually works.

Reported-by: Guus der Kinderen <guus@goodbytes.nl>
2023-02-11 16:13:07 +01:00
Florian Schmaus
a2a22883d2 [websocket] Override AbstractWebSocket.toString() 2023-02-11 16:12:26 +01:00
Florian Schmaus
c5bb15c631 [sinttest] Add UnconnectedConnectionSource for low-level tests
Previously low-level tests where run, potentially multiple times, with
the default connection descriptor.

Reported-by: Guus der Kinderen <guus@goodbytes.nl>
2023-02-11 13:02:23 +01:00
Florian Schmaus
92f1fe647b [websocket] Factor out known websocket ports in private static fields 2023-02-03 20:57:27 +01:00
Florian Schmaus
ae2c53f78c
Merge pull request #543 from guusdk/websocket-default-port
Websocket implicit discovery should use common ports
2023-02-03 20:54:32 +01:00
Guus der Kinderen
3a84a1ff47 s/ the the / the /g 2023-02-03 20:53:14 +01:00
Florian Schmaus
07f157b00f
Merge pull request #547 from Flowdalic/docs-to-javadoc
Migrate markdown documentation to javadoc
2023-02-03 20:43:35 +01:00
Florian Schmaus
c9a9982cef Migrate markdown documentation to javadoc
While markdown is easier to write, Smack's markdown documentation was
never tightly coupled with the source. For example, the markdown
documentation never provided links to the actual Java classes and
methods. This poses the risk that the documentation and the code
diverge over time. Furthermore, javadoc is constantly improving (for
example @snippet annotations) and I expect that one will be able to
write javadoc in markdown.

Fixes SMACK-928.
2023-02-03 09:50:35 +01:00
Guus der Kinderen
3f13d90a56 Websocket implicit discovery should use common ports
When enabled, the websocket implementation will attempt to use two implicit endpoints, using these URLs:
- `wss://[host]:5443/ws`
- `ws://[host]:5443/ws`

These endpoints should include ports that are used by default by known implementations, such as 5280/5281 (Prosody) and 7070/7443 (Openfire).
2023-01-19 13:09:20 +01:00
Florian Schmaus
5295a856e4
Merge pull request #541 from Flowdalic/drop-in-ordered-listener
[core] Replace AbstractXMPPConnection.inOrderListeners
2022-10-05 11:44:11 +02:00
Florian Schmaus
92f253cc74 [core] Replace AbstractXMPPConnection.inOrderListeners
Using AsyncButOrdered for the receive listeners means that a listener
may not have been yet run once
invokeStanzaCollectorsAndNotifyRecvListeners() returnes. This can lead
to deadlocks as reported by Boris Grozev [1].

Fixes SMACK-927.

1: https://discourse.igniterealtime.org/t/thread-stuck-in-multiuserchat-enter-forever/92090
2022-10-05 11:28:48 +02:00
Florian Schmaus
f65cf45b5c [README] Fix MUC badge 2022-09-02 16:48:57 +02:00
Florian Schmaus
875fb7fcfd Merge branch '4.4' 2022-09-02 16:17:12 +02:00
Florian Schmaus
9486fd6176 [muc] Remove stale comment from MultiUserChat.userHashLeft()
Set started with Smack 4.4 to set myRoomJid to null, introduced by
ab2822be3e ("muc: also set myRoomJid to null if we have left the
room"), however the code comment still states that we "do not reset
nickname here" (and myRoomJid contains the nickname as its
resourcepart).

Reported-by: Damian Minkov <damencho@jitsi.org>
2022-09-02 16:13:49 +02:00
Florian Schmaus
c232ca5cb0 Update README 2022-08-30 22:05:51 +02:00
Florian Schmaus
5455cfb3d2 Merge branch '4.4' 2022-08-30 21:54:49 +02:00
Florian Schmaus
c081585c26
Merge pull request #539 from tharkum/4.4
[muc] Fix removal of the MUC's main presence interceptor
2022-08-30 22:53:36 +03:00
Andrey Volykhin
fbd5761296 [muc] Fix removal of the MUC's main presence interceptor
On dinamically remove the last existed presence interceptor
we also should to remove the MUC's main presence interceptor from the connection.

Fixes: 60fee7b ("[muc] Fix Presence interceptors")
2022-08-30 11:57:23 +00:00
Florian Schmaus
9eee3b8d76 [muc] Fix GroupChatInviation's constructor
Fixes: 5e1cd62021 ("[muc] Null-check GroupChatInviation's 'roomAddress' argument")
2022-08-07 17:03:05 +02:00
Florian Schmaus
e87da18495 Bump Bouncy Castle to 1.71 2022-08-07 16:59:47 +02:00
Florian Schmaus
167af86f79 [core] Make ExtensionElementFilter's constructor public 2022-08-07 16:55:41 +02:00
Florian Schmaus
2c05754018
Merge pull request #533 from Flowdalic/send-non-blocking
Add non-blocking send
2022-08-03 17:57:08 +02:00
Florian Schmaus
5e1cd62021 [muc] Null-check GroupChatInviation's 'roomAddress' argument 2022-08-03 17:39:30 +02:00
Florian Schmaus
c8d0e65ccc [java8-full] Add BoshConnectionTest 2022-08-03 17:37:49 +02:00
Florian Schmaus
e768bc8bfb [bosh] Allow for file to be 'null' 2022-08-03 16:58:31 +02:00
Florian Schmaus
6eb1004d38 [bosh] Properly implement isSecureConnection() 2022-08-03 16:58:12 +02:00
Florian Schmaus
c77948bb91 Add non-blocking send 2022-08-03 16:57:57 +02:00
Florian Schmaus
711d7d92bd [muc] Use EntityBareJid instead of String in GroupChatInvitation
Also factor provider in extra file.
2022-08-01 21:54:37 +02:00
Florian Schmaus
ccf60b018e
Merge pull request #534 from vanitasvitae/bumpPGPainless
Bump pgpainless-core to 1.3.1
2022-07-31 10:02:59 +02:00
b7dd26af05
Bump pgpainless-core to 1.3.1 2022-06-29 15:46:17 +02:00
Florian Schmaus
8c359eed16 Smack 4.4.7-SNAPSHOT 2022-06-29 10:18:40 +02:00
Florian Schmaus
a82ae41c22 Smack 4.4.6 2022-06-29 09:31:08 +02:00
Florian Schmaus
44ad01a346
Merge pull request #532 from Flowdalic/gradlew
Add gradle wrapper
2022-06-07 08:56:27 +02:00
Florian Schmaus
4f72eca21c Add gradle wrapper
I am not happy with the concept of a build system wrapper, not to say
that I despise it. There is no reason why a single machine couldn't
have multiple versions of a build system-wide installed, and there is
no reason why each developer should download an individual copy of a
build system into the developers home directory. But here we are…
2022-06-07 08:46:18 +02:00
Florian Schmaus
6be3eb194a Merge branch '4.4' 2022-06-07 08:41:46 +02:00
Florian Schmaus
382ec723a8
Merge pull request #531 from Flowdalic/truely-async-sends
[core] Add AbstractXMPPConnection.TRUELY_ASYNC_SENDS
2022-06-06 10:01:28 +02:00
Florian Schmaus
66370c7ef5 [core] Add SmackConfiguration.TRUELY_ASYNC_SENDS
This option is meant a quick and dirty hack until
XMPPConnection.sendStanza() throws a dedicated Exception in case the
connection's outgoing queue is full.
2022-06-06 09:52:57 +02:00
Florian Schmaus
52a3490e07
Merge pull request #530 from Flowdalic/fix-bosh-url
[bosh] Fix BOSHConfiguration.getURI()
2022-05-26 20:21:14 +02:00
Florian Schmaus
8ebe453363 [bosh] Fix BOSHConfiguration.getURI()
Reported-by: Damian Minkov <damencho@jitsi.org>
Fixes: aa441d743c ("[bosh] Use ConnectionConfiguration.getHostString() in BOSHConfiguration")
2022-05-26 19:53:06 +02:00
Florian Schmaus
70d0843dd8 Merge branch '4.4' 2022-05-26 18:13:29 +02:00
Florian Schmaus
c9af6576c0
Merge pull request #529 from Flowdalic/fix-sd-memleak
[disco] Fix memory leak in ServiceDiscoveryManager
2022-05-26 18:11:54 +02:00
Florian Schmaus
69e81b748e [disco] Only perform entity capabilities work if there are any listeners 2022-05-26 18:03:36 +02:00
Florian Schmaus
5b6dd8e3f7 [disco] Fix memory leak in ServiceDiscoveryManager
The lambda we schedule in 25ms captures a strong reference to the
XMPPConnection. However the lambda is part of the scheduled action,
which we save in the renewEntityCapsScheduledAction field. This causes
a memory leak, since the ServiceDiscoveryManager now holds a strong
reference to its XMPPConnection.

Fix this by obtaining the strong reference to the XMPPConnection, if
one still exists, within the lambda.

Fixes SMACK-926.

Reported-by: Damian Minkov <damencho@jitsi.org>
2022-05-26 15:39:41 +02:00
Florian Schmaus
c84ac4b2ae Merge branch '4.4' 2022-05-23 12:32:29 +02:00
Florian Schmaus
f402a9d12d
Merge pull request #528 from Flowdalic/fix-mux-presence-interceptor
[muc] Fix Presence interceptors
2022-05-23 12:30:58 +02:00
Florian Schmaus
60fee7b318 [muc] Fix Presence interceptors
Presence interceptors where hooked into stanza sending listeners,
which are called *after* the stanza has been put on the wire, i.e., to
late for interceptors that any modifications, they may perform, to
take effect.

Fixes SMACK-925.

We now also dynamically add the MUC's main presence interceptor to the
connection.

Reported-by: Damian Minkov <damencho@jitsi.org>
2022-05-22 10:51:45 +02:00
Florian Schmaus
e51bfb1dbe Merge branch '4.4' 2022-05-18 21:46:19 +02:00