Skip to content

Commit

Permalink
fix proxyConnection issue
Browse files Browse the repository at this point in the history
  • Loading branch information
deleolajide committed Dec 20, 2021
1 parent d424859 commit d1b964f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
8 changes: 4 additions & 4 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ call mvn clean package -Dmaven.test.skip=true

cd target
rename pade-openfire-plugin-assembly.jar pade.jar
rd "C:\openfire_4_6_3\plugins\pade" /q /s
del "C:\openfire_4_6_3\plugins\pade.jar"
del /q "C:\openfire_4_6_3\logs\*.*"
copy pade.jar C:\openfire_4_6_3\plugins\pade.jar
rd "C:\openfire_4_7_0\plugins\pade" /q /s
del "C:\openfire_4_7_0\plugins\pade.jar"
del /q "C:\openfire_4_7_0\logs\*.*"
copy pade.jar C:\openfire_4_7_0\plugins\pade.jar

rd "D:\Projects\openfire-cluster\node1\plugins\pade" /q /s
del "D:\Projects\openfire-cluster\node1\plugins\pade.jar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ public synchronized void initialize(final PluginManager manager, final File plug
" http-servers {",
" private {",
" port = " + rest_port,
" host = " + local_ip,
" host = " + JiveGlobals.getProperty( "ofmeet.videobridge.rest.host", ipAddress),
" }",
" public {",
" port = " + plain_port,
" host = " + public_ip,
" host = " + JiveGlobals.getProperty( "ofmeet.videobridge.rest.host", ipAddress),
" }",
" }",
"",
Expand Down
22 changes: 13 additions & 9 deletions src/java/org/jivesoftware/openfire/plugin/ofmeet/OfMeetPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public static class JvbSocketCreator implements WebSocketCreator
{
@Override public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp)
{
String ipaddr = getIpAddress();
String ipaddr = JiveGlobals.getProperty( "ofmeet.videobridge.rest.host", OfMeetPlugin.self.getIpAddress());
String jvbPort = JiveGlobals.getProperty( "ofmeet.websockets.plainport", "8180");

HttpServletRequest request = req.getHttpServletRequest();
Expand All @@ -447,7 +447,7 @@ public static class JvbSocketCreator implements WebSocketCreator

Log.info("JvbSocketCreator " + path + " " + query);

String url = "ws://localhost:" + jvbPort + path;
String url = "ws://" + ipaddr + ":" + jvbPort + path;

ProxyWebSocket socket = null;
ProxyConnection proxyConnection = new ProxyConnection(URI.create(url), protocols, 10000);
Expand Down Expand Up @@ -561,16 +561,20 @@ private void checkDownloadFolder(File pluginDirectory)
}
}

public static String getIpAddress()
public String getIpAddress()
{
String ourHostname = XMPPServer.getInstance().getServerInfo().getHostname();
String ourIpAddress = "127.0.0.1";

try {
ourIpAddress = InetAddress.getByName(ourHostname).getHostAddress();
} catch (Exception e) {
String ourIpAddress = JiveGlobals.getXMLProperty("network.interface");

if (ourIpAddress == null) {
ourIpAddress = "127.0.0.1";

try {
ourIpAddress = InetAddress.getByName(ourHostname).getHostAddress();
} catch (Exception e) {

}
}
}

return ourIpAddress;
}
Expand Down

0 comments on commit d1b964f

Please sign in to comment.