Skip to content

Commit 6ca96e7

Browse files
committed
Merge branch 'master' into fixes
2 parents 5e3b912 + aef3b62 commit 6ca96e7

File tree

6 files changed

+304
-216
lines changed

6 files changed

+304
-216
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<properties>
2121
<assembly.skipAssembly>true</assembly.skipAssembly>
2222
<exec.mainClass>org.jitsi.videobridge.Main</exec.mainClass>
23-
<jitsi-desktop.version>2.13.f0a8003</jitsi-desktop.version>
23+
<jitsi-desktop.version>2.13.389bc25</jitsi-desktop.version>
2424
<smack.version>4.2.2-b1c107f</smack.version>
2525
</properties>
2626

src/main/java/org/jitsi/videobridge/IceUdpTransportManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.jitsi.service.neomedia.*;
3939
import org.jitsi.util.*;
4040
import org.jitsi.util.Logger;
41+
import org.jitsi.videobridge.health.*;
4142
import org.jitsi.videobridge.rest.*;
4243
import org.osgi.framework.*;
4344

@@ -1795,6 +1796,16 @@ else if (transport == Transport.UDP)
17951796
getChannels().forEach(Channel::transportConnected);
17961797
}
17971798

1799+
/**
1800+
* The name of the property which controls whether health checks failures
1801+
* should be permanent. If this is set to true and the bridge fails its
1802+
* health check once, it will not go back to the healthy state.
1803+
*/
1804+
private static final String PERMANENT_FAILURE_PNAME
1805+
= Health.class.getName() + ".PERMANENT_FAILURE";
1806+
1807+
private static BundleContext bundleContext = null;
1808+
private static boolean permanentFailureMode = false;
17981809
/**
17991810
* @return the {@link Transport} (e.g. UDP or TCP) of the selected pair
18001811
* of this {@link IceUdpTransportManager}. If the transport manager is

src/main/java/org/jitsi/videobridge/Videobridge.java

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,12 @@ public static Collection<Videobridge> getVideobridges(
218218
*/
219219
private VideobridgeExpireThread videobridgeExpireThread;
220220

221+
/**
222+
* The {@link Health} instance responsible for periodically performing
223+
* health checks on this videobridge.
224+
*/
225+
private Health health;
226+
221227
/**
222228
* Initializes a new <tt>Videobridge</tt> instance.
223229
*/
@@ -1210,12 +1216,13 @@ public IQ handleHealthCheckIQ(HealthCheckIQ healthCheckIQ)
12101216

12111217
try
12121218
{
1213-
Health.check(this);
1219+
healthCheck();
12141220

12151221
return IQ.createResultIQ(healthCheckIQ);
12161222
}
12171223
catch (Exception e)
12181224
{
1225+
e.printStackTrace();
12191226
return
12201227
IQUtils.createError(
12211228
healthCheckIQ,
@@ -1224,6 +1231,27 @@ public IQ handleHealthCheckIQ(HealthCheckIQ healthCheckIQ)
12241231
}
12251232
}
12261233

1234+
/**
1235+
* Checks the health of this {@link Videobridge}. If it is healthy it just
1236+
* returns silently, otherwise it throws an exception. Note that this
1237+
* method does not perform any tests, but only checks the cached value
1238+
* provided by the bridge's {@link Health} instance.
1239+
*
1240+
* @throws Exception if the videobridge is not healthy.
1241+
*/
1242+
public void healthCheck()
1243+
throws Exception
1244+
{
1245+
if (health == null)
1246+
{
1247+
throw new Exception("No health checks running");
1248+
}
1249+
else
1250+
{
1251+
health.check();
1252+
}
1253+
}
1254+
12271255
/**
12281256
* Handles a <tt>GracefulShutdownIQ</tt> stanza which represents a request.
12291257
*
@@ -1309,7 +1337,9 @@ public boolean isXmppApiEnabled()
13091337
= ServiceUtils.getService(
13101338
getBundleContext(), ConfigurationService.class);
13111339

1312-
return config.getBoolean(Videobridge.XMPP_API_PNAME, false);
1340+
// The XMPP API is disabled by default.
1341+
return config != null &&
1342+
config.getBoolean(Videobridge.XMPP_API_PNAME, false);
13131343
}
13141344

13151345
/**
@@ -1382,7 +1412,11 @@ void start(final BundleContext bundleContext)
13821412
ConfigurationService.class);
13831413

13841414
videobridgeExpireThread.start(bundleContext);
1385-
Health.start(this);
1415+
if (health != null)
1416+
{
1417+
health.stop();
1418+
}
1419+
health = new Health(this, cfg);
13861420

13871421
defaultProcessingOptions
13881422
= (cfg == null)
@@ -1611,9 +1645,14 @@ private void startIce4j(
16111645
void stop(BundleContext bundleContext)
16121646
throws Exception
16131647
{
1614-
Health.stop(this);
16151648
try
16161649
{
1650+
if (health != null)
1651+
{
1652+
health.stop();
1653+
health = null;
1654+
}
1655+
16171656
ConfigurationService cfg
16181657
= ServiceUtils2.getService(
16191658
bundleContext,

0 commit comments

Comments
 (0)