1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-15 08:42:05 +01:00
Commit graph

1099 commits

Author SHA1 Message Date
Florian Schmaus
9acee05e5e [core] Improve how the selected keys are copied in SmackReactor 2023-12-07 11:20:37 +01:00
Florian Schmaus
844ebbf4c5 [core] Add milliseconds to ConsoleDebugger's timestamp 2023-12-06 20:55:37 +01:00
Florian Schmaus
dac06b04c3 [core] Add XmlStringBuilder.setAppendApproach() 2023-11-28 11:04:24 +01:00
Florian Schmaus
5a78534443 [core] Mark LazyStringBuilder's String cache as transient 2023-11-26 21:35:19 +01:00
Florian Schmaus
6322f4f826 [core] Add global option to flatten when appending in XmlStringBuilder
For certain use cases, this provides a performance improvement,
probably due better cache locality. However, it comes with the cost of
additional memory consumption.

This was initially suggested by Boris Grozev, who also reported a
significant performance problem of
XmlStringBuilder/LazyStringBuilder. However, the main cause of the
performance probelm was the missing caching of LazyStringBuilder. The
length of the lazy string is now cached by LazyStringBuidler since
70e48300a6 ("[core] Cache length in LazyStringBuilder"), which
accounts for large performance improvement. A significantly smaller
improvement is achieved by this commit and setting
XmlStringBuilder.FLAT_APPEND to 'true'.

Suggested-by: Boris Grozev <boris@jitsi.org>
2023-11-26 21:34:13 +01:00
Florian Schmaus
70e48300a6 [core] Cache length in LazyStringBuilder 2023-11-26 21:24:17 +01:00
Florian Schmaus
b5b4418406 Merge branch '4.4' 2023-11-25 17:36:15 +01:00
Florian Schmaus
a270542397 [core] Improve javadoc for listeners
With 92f253cc74 ("[core] Replace
AbstractXMPPConnection.inOrderListeners") we changes the behavior of
listeners. This commit documents the expectations to the user.
2023-11-24 12:59:04 +01:00
Florian Schmaus
f593b6d0a0 [core] Whitespace fix in XMPPConnection's javadoc 2023-11-24 12:18:19 +01:00
Martin Fidczuk
ffd027cc7d
Use XMPP connection as local SOCKS5 address
The default local address is often just "the first address found in the list of addresses read from the OS" and this might mean an internal IP address that cannot reach external servers. So wherever possible use the same IP address being used to connect to the XMPP server because this local address has a better chance of being suitable.

This MR adds the above behaviour, and two UTs to test that we use the local XMPP connection IP when connected, and the previous behaviour when not.
2023-04-26 10:00:23 +01:00
Florian Schmaus
f78eade4da Merge branch '4.4' 2023-03-17 18:20:20 +01:00
Florian Schmaus
bf3a27df9a [core] Fix ErrorIQ not showing potential original IQ child
Also delete StanzaIdTest since the test was fundamentally weak and
flawed. It does not work anyway, since TestIQ has a fixed stanza ID.

Fixes SMACK-931.
2023-03-17 18:03:57 +01:00
Florian Schmaus
dee34b5efc [core] Add InternetAddress.fromIgnoringZoneId(String) 2023-02-12 16:06:53 +01:00
Guus der Kinderen
3a84a1ff47 s/ the the / the /g 2023-02-03 20:53:14 +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
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
167af86f79 [core] Make ExtensionElementFilter's constructor public 2022-08-07 16:55:41 +02:00
Florian Schmaus
c77948bb91 Add non-blocking send 2022-08-03 16:57:57 +02:00
Florian Schmaus
6be3eb194a Merge branch '4.4' 2022-06-07 08:41:46 +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
e51bfb1dbe Merge branch '4.4' 2022-05-18 21:46:19 +02:00
Florian Schmaus
00bcbff5ee [core] Add ConnectionConfiguration.getHostString() 2022-05-18 21:45:00 +02:00
Florian Schmaus
70abd8a182 Merge branch '4.4' 2022-04-30 15:16:24 +02:00
Florian Schmaus
881ebe731d [core] Fix typo in javadoc 2022-04-30 15:15:51 +02:00
Florian Schmaus
1f5326abb2 [core] Inline waitForConditionOrConnectionException
Using any of the two methods is error prone, see 0e0c0a4093 ("[tcp]
Fix handling in connection exceptions when resuming a stream"), as one
can easily forget to check for connection exceptions after it
returned. There are also no longer any call sites of those methods.

Let's inline both variants of this method.
2022-04-30 15:15:42 +02:00
Ingo Bauersachs
4efa707028 Replace legacy IQProvider with IqProvider 2022-04-02 16:02:46 +02:00
Florian Schmaus
a15110694a Merge branch '4.4' 2022-02-18 21:30:42 +01:00
Florian Schmaus
ba2e36dbc3 [core] Deprecate some SSLContext config options and add KeyManager option
Smack historically provided fine-grained options for the
SSLContext. This is however not flexible enough, as an option to
specifiy the KeyManager(s) was missing.

This deprecated the options for keystore path, keystore type, and
PKCS#11 library, in favor of an option to set the KeyManager, which
could be aware of the keystore path and type, and the PKCS#11
library. At some point, Smack may provide some high-level methods to
create a KeyManager from provided keystore path, keytsore type and
PKCS#11 library.
2022-02-17 12:17:54 +01:00
Florian Schmaus
4a83d2957e Merge branch '4.4' 2022-02-06 17:48:08 +01:00
Boris Grozev
67a5c3a41a [core] Correctly handle due time of '0' in SmackReactor
Scheduled actions that are due in 0 milliseconds are due
immediately. Otherwise we would invoke select() with 0.

Fixes SMACK-923.
2022-02-06 17:38:50 +01:00
Florian Schmaus
ad9867ebdf Merge branch '4.4' 2022-02-03 08:43:32 +01:00
Florian Schmaus
5cd7a6c60e
Merge pull request #509 from Flowdalic/jingle-reason-extension-element
Jingle reason extension element
2022-02-03 07:58:29 +01:00
Florian Schmaus
3ff553549a [SmackFuture] Invoke the callbacks at most once
Previously, if a SmackFuture both was successful and unsuccessful, it
was possible that the onSuccess() callback was invoked twice.

Reported-by: Boris Grozev <boris@jitsi.org>
2022-02-02 20:47:31 +01:00
cmeng-git
4cdb4acf26 [core] Fix IQProvider javadoc
It is IqProvider that should be used instead.
2022-02-02 12:13:25 +01:00
Florian Schmaus
c06cf72337 [core] Support IqProvider in SmackTestUtil 2022-02-02 10:41:00 +01:00
Florian Schmaus
0e637068e6 [core] Factor PacketParserUtils.parseIqData() in extra method 2022-02-02 10:41:00 +01:00
Florian Schmaus
1dae0c0c32 [core] Use Enum.toString() in XmlStringBuilder.attribute(String, Enum<?>)
All other enum-using methods of XmlStringBuilder already use
Enum.toString(), as opposed to Enum.name(), this was the only left. I
do not remember why I did not to change this method too, probably
because of its plenty call sites.

But since this method already broke Jingle XML serializaton,
JingleAction was e.g., 'session_accept' when it should be
'session-accept', we change it now.

Fixes SMACK-921.
2022-01-22 11:08:35 +01:00
Florian Schmaus
1a727c152e [core] Improve warning message of ExceptionThrowingCallbackWithHint 2022-01-22 10:24:01 +01:00
Florian Schmaus
10a2687ff1 [sinttest] Allow the selection of individual test *methods* 2021-12-13 21:08:45 +01:00
Florian Schmaus
11cc2d8d77 [core] Align behavior of getParserFor(InputStream) and getParserFor(Reader)
Reported-by: Ingo Bauersachs <ingo@jitsi.org>
2021-11-30 10:49:55 +01:00
Florian Schmaus
cad63bc107 Merge branch '4.4' 2021-11-09 15:30:02 +01:00
Florian Schmaus
8736e3e434 [core] Remove erroneous "assert !connected" in connect()
Connections like XMPPTCPConnection may still reported connected, if
they are, for example disconnected but resumable. This is already
accounted for in throwAlreadyConnectedExceptionIfAppropriate(), hence
the assert is unnecessary and leads to false negatives for
XMPPTCPConnection.

For the sake of completeness, the right condition, assuming
XMPPTCPConnection is used, for the assert would be:

	assert !connected || disconnectedButResumable;
2021-11-05 10:19:26 +01:00
Florian Schmaus
7dc8cc176e [core] Add DoOnce utility 2021-11-01 19:27:09 +01:00
Florian Schmaus
fa88f78232 Merge branch '4.4' 2021-10-25 17:05:12 +02:00
Jonathan Lennox
4ae3fbb073 Add removeExtension methods to StanzaBuilder. 2021-10-25 14:50:45 +00:00
Florian Schmaus
e842195b71 Merge branch '4.4' 2021-10-19 14:33:21 +02:00
Florian Schmaus
ab92bc4b40
Merge pull request #501 from Flowdalic/fix-redundant-namespaces
Fix redundant namespaces
2021-10-19 14:29:18 +02:00
Florian Schmaus
0fa6d88575
Merge pull request #500 from jitsi/bugfix/4.4/error-stanzagetter
Add getter for the stanza associated with the exception
2021-10-19 14:29:11 +02:00
Florian Schmaus
9fb7d6d97c
Merge pull request #497 from jitsi/bugfix/4.4/sasl-anonymous
Prevent password enforcement for SASL anonymous
2021-10-19 14:09:39 +02:00
Florian Schmaus
b243a40e26 [core] Pass down the XML environment in IQChildElementXmlStringBuilder
This allows to avoid redundant XML namespaces within IQs, like for
example here:

<iq xmlns='jabber:client' id='EKP8I-1' type='set'>
    <jingle xmlns='urn:xmpp:jingle:1' action='content-accept' sid='MySession'>
        <content xmlns='urn:xmpp:jingle:1' creator='initiator' name='Hello world'>
        </content>
    </jingle>
</iq>

Fixes SMACK-917

Reported-by: Jonathan Lennox
2021-10-19 11:29:23 +02:00