Skip to content

Commit

Permalink
Fixes a xmpp bosh connection and protocol providers leakage.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho authored and bgrozev committed Mar 21, 2019
1 parent 4dbe945 commit 3498776
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<properties>
<assembly.skipAssembly>true</assembly.skipAssembly>
<smack.version>4.2.4-47d17fc</smack.version>
<jitsi-desktop.version>2.13.d455bdc</jitsi-desktop.version>
<jitsi-desktop.version>2.13.17a6a27</jitsi-desktop.version>
</properties>

<dependencies>
Expand Down
37 changes: 37 additions & 0 deletions src/main/java/org/jitsi/jigasi/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jitsi.service.configuration.*;
import org.jitsi.service.neomedia.*;
import org.jitsi.util.*;
import org.jivesoftware.smack.*;

/**
* FIXME: update description
Expand Down Expand Up @@ -146,6 +147,28 @@ public class Main
*/
private static final String CONFIG_DIR_NAME_ARG_NAME = "--configdirname";

/**
* A list of packages(iq providers) not used by jigasi.
* Removing them from smack, removes a lot of weakHashMaps and
* connection listeners.
*/
private static final String[] disabledSmackPackages
= new String[]
{
"org.jivesoftware.smackx.iqlast",
"org.jivesoftware.smackx.xdata",
"org.jivesoftware.smackx.eme",
"org.jivesoftware.smackx.bytestreams.socks5",
"org.jivesoftware.smackx.iqprivate",
"org.jivesoftware.smackx.bytestreams.ibb",
"org.jivesoftware.smackx.bookmarks",
"org.jivesoftware.smackx.receipts",
"org.jivesoftware.smackx.commands",
"org.jivesoftware.smackx.privacy",
"org.jivesoftware.smackx.time",
"org.jivesoftware.smackx.muc.bookmarkautojoin"
};

public static void main(String[] args)
throws ParseException
{
Expand Down Expand Up @@ -226,6 +249,9 @@ public static void main(String[] args)
System.setProperty(ConfigurationActivator.PNAME_USE_PROPFILE_CONFIG,
"true");

// disable smack packages before loading smack
disableSmackProviders();

ComponentMain main = new ComponentMain();

main.runMainProgramLoop(
Expand All @@ -236,4 +262,15 @@ public static void main(String[] args)
host, port, domain, subdomain, secret),
new JigasiBundleConfig());
}

/**
* Disables some unused smack packages.
*/
private static void disableSmackProviders()
{
for (String classPackage: disabledSmackPackages)
{
SmackConfiguration.addDisabledSmackClass(classPackage);
}
}
}

0 comments on commit 3498776

Please sign in to comment.