- determine port test connection type
This commit is contained in:
parent
3f467cb579
commit
b0e5d61dee
@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.bigbluebutton.main.model
|
||||
{
|
||||
|
||||
import flash.events.NetStatusEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.net.NetConnection;
|
||||
@ -29,7 +28,7 @@ package org.bigbluebutton.main.model
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.core.model.LiveMeeting;
|
||||
import org.bigbluebutton.util.ConnUtil;
|
||||
|
||||
[Bindable]
|
||||
/**
|
||||
@ -125,12 +124,12 @@ package org.bigbluebutton.main.model
|
||||
} else {
|
||||
this.port = port;
|
||||
}
|
||||
// Construct URI.
|
||||
if (tunnel) {
|
||||
this.baseURI = "rtmpt://" + this.hostname + "/" + this.application;
|
||||
} else {
|
||||
this.baseURI = "rtmp://" + this.hostname + this.port + "/" + this.application;
|
||||
}
|
||||
}
|
||||
|
||||
private function parseRTMPConn(appURL: String):Array {
|
||||
var pattern:RegExp = /(?P<protocol>.+):\/\/(?P<server>.+)/;
|
||||
var result:Array = pattern.exec(appURL);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,8 +138,34 @@ package org.bigbluebutton.main.model
|
||||
public function connect():void {
|
||||
nc = new NetConnection();
|
||||
nc.client = this;
|
||||
nc.proxyType = "best";
|
||||
|
||||
trace("******** Connecting PORT TEST hostname= " + this.hostname);
|
||||
var pattern:RegExp = /(?P<protocol>.+):\/\/(?P<server>.+)/;
|
||||
var result:Array = pattern.exec(this.hostname);
|
||||
var useRTMPS: Boolean = result.protocol == ConnUtil.RTMPS;
|
||||
|
||||
// Construct URI.
|
||||
if (tunnel) {
|
||||
trace("******** Connecting PORT TEST tunnel= " + tunnel);
|
||||
var tunnelProtocol: String = ConnUtil.RTMPT;
|
||||
if (useRTMPS) {
|
||||
tunnelProtocol = ConnUtil.RTMPS;
|
||||
nc.proxyType = ConnUtil.PROXY_NONE;
|
||||
}
|
||||
this.baseURI = tunnelProtocol + "://" + result.server + "/" + this.application;
|
||||
|
||||
} else {
|
||||
trace("******** Connecting PORT TEST tunnel= " + tunnel);
|
||||
var nativeProtocol: String = ConnUtil.RTMP;
|
||||
if (useRTMPS) {
|
||||
nativeProtocol = ConnUtil.RTMPS;
|
||||
nc.proxyType = ConnUtil.PROXY_BEST;
|
||||
}
|
||||
this.baseURI = nativeProtocol + "://" + result.server + "/" + this.application;
|
||||
}
|
||||
|
||||
|
||||
nc.objectEncoding = ObjectEncoding.AMF3;
|
||||
nc.addEventListener( NetStatusEvent.NET_STATUS, netStatus );
|
||||
// connect to server
|
||||
try {
|
||||
@ -155,6 +180,8 @@ package org.bigbluebutton.main.model
|
||||
connectionTimer.start();
|
||||
|
||||
var curTime:Number = new Date().getTime();
|
||||
|
||||
trace("******** Connecting PORT TEST = " + this.baseURI);
|
||||
// Create connection with the server.
|
||||
nc.connect( this.baseURI, "portTestMeetingId-" + curTime,
|
||||
"portTestDummyUserId-" + curTime, "portTestDummyAuthToken");
|
||||
@ -175,7 +202,7 @@ package org.bigbluebutton.main.model
|
||||
logData.tags = ["initialization", "port-test", "connection"];
|
||||
logData.message = "Port testing connection timedout.";
|
||||
LOGGER.info(JSON.stringify(logData));
|
||||
|
||||
trace("******** Connect FAILED PORT TEST = " + this.baseURI);
|
||||
status = "FAILED";
|
||||
_connectionListener(status, tunnel, hostname, port, application);
|
||||
closeConnection();
|
||||
@ -232,11 +259,13 @@ package org.bigbluebutton.main.model
|
||||
logData.connection = this.baseURI;
|
||||
logData.tags = ["initialization", "port-test", "connection"];
|
||||
|
||||
trace("******** Connect SUCCESS PORT TEST connected= " + nc.connected);
|
||||
|
||||
if ( statusCode == "NetConnection.Connect.Success" ) {
|
||||
status = "SUCCESS";
|
||||
logData.message = "Port test successfully connected.";
|
||||
LOGGER.info(JSON.stringify(logData));
|
||||
|
||||
trace("******** Connect SUCCESS PORT TEST = " + this.baseURI);
|
||||
_connectionListener(status, tunnel, hostname, port, application);
|
||||
} else if ( statusCode == "NetConnection.Connect.Rejected" ||
|
||||
statusCode == "NetConnection.Connect.Failed" ||
|
||||
@ -244,7 +273,7 @@ package org.bigbluebutton.main.model
|
||||
logData.statusCode = statusCode;
|
||||
logData.message = "Port test failed to connect.";
|
||||
LOGGER.info(JSON.stringify(logData));
|
||||
|
||||
trace("******** Connect FAILED (2) PORT TEST = " + this.baseURI);
|
||||
status = "FAILED";
|
||||
_connectionListener(status, tunnel, hostname, port, application);
|
||||
|
||||
|
4
bigbluebutton-client/src/org/bigbluebutton/main/model/PortTestProxy.as
Normal file → Executable file
4
bigbluebutton-client/src/org/bigbluebutton/main/model/PortTestProxy.as
Normal file → Executable file
@ -36,7 +36,9 @@ package org.bigbluebutton.main.model {
|
||||
this.modulesDispatcher = modulesDispatcher;
|
||||
}
|
||||
|
||||
public function connect(tunnel:Boolean, hostname:String = "", port:String = "", application:String = "", testTimeout:Number = 10000):void {
|
||||
public function connect( tunnel:Boolean, hostname:String = "",
|
||||
port:String = "", application:String = "",
|
||||
testTimeout:Number = 10000):void {
|
||||
this.tunnel = tunnel;
|
||||
portTest = new PortTest(tunnel, hostname, port, application, testTimeout);
|
||||
portTest.addConnectionSuccessListener(connectionListener);
|
||||
|
@ -22,16 +22,12 @@ package org.bigbluebutton.main.model.modules
|
||||
|
||||
import flash.system.ApplicationDomain;
|
||||
import flash.utils.Dictionary;
|
||||
|
||||
import mx.collections.ArrayCollection;
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.common.IBigBlueButtonModule;
|
||||
import org.bigbluebutton.core.BBB;
|
||||
import org.bigbluebutton.core.Options;
|
||||
import org.bigbluebutton.main.events.AppVersionEvent;
|
||||
import org.bigbluebutton.main.model.options.PortTestOptions;
|
||||
|
||||
public class ModuleManager
|
||||
{
|
||||
@ -48,11 +44,11 @@ package org.bigbluebutton.main.model.modules
|
||||
|
||||
private var modulesDispatcher:ModulesDispatcher;
|
||||
|
||||
private var portTestOptions : PortTestOptions;
|
||||
|
||||
|
||||
public function ModuleManager(modulesDispatcher: ModulesDispatcher)
|
||||
{
|
||||
this.modulesDispatcher = modulesDispatcher;
|
||||
this.modulesDispatcher = modulesDispatcher;
|
||||
_applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
|
||||
}
|
||||
|
||||
@ -66,8 +62,6 @@ package org.bigbluebutton.main.model.modules
|
||||
var resolver:DependancyResolver = new DependancyResolver();
|
||||
sorted = resolver.buildDependencyTree(modules);
|
||||
|
||||
portTestOptions = Options.getOptions(PortTestOptions) as PortTestOptions;
|
||||
|
||||
modulesDispatcher.sendPortTestEvent();
|
||||
}
|
||||
|
||||
@ -75,23 +69,7 @@ package org.bigbluebutton.main.model.modules
|
||||
BBB.getConfigManager();
|
||||
BBB.loadConfig();
|
||||
}
|
||||
|
||||
public function useProtocol(tunnel:Boolean):void {
|
||||
BBB.initConnectionManager().isTunnelling = tunnel;
|
||||
}
|
||||
|
||||
public function get portTestHost():String {
|
||||
return portTestOptions.host;
|
||||
}
|
||||
|
||||
public function get portTestApplication():String {
|
||||
return portTestOptions.application;
|
||||
}
|
||||
|
||||
public function get portTestTimeout():Number {
|
||||
return portTestOptions.timeout;
|
||||
}
|
||||
|
||||
|
||||
private function getModule(name:String):ModuleDescriptor {
|
||||
return BBB.getConfigManager().getModuleFor(name);
|
||||
}
|
||||
|
@ -20,8 +20,9 @@ package org.bigbluebutton.main.model.modules
|
||||
{
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.core.BBB;
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.main.model.PortTestProxy;
|
||||
import org.bigbluebutton.main.model.PortTestProxy;
|
||||
|
||||
public class ModulesProxy {
|
||||
private static const LOGGER:ILogger = getClassLogger(ModulesProxy);
|
||||
@ -49,7 +50,7 @@ package org.bigbluebutton.main.model.modules
|
||||
logData.message = "Successfully tested connection to server.";
|
||||
LOGGER.info(JSON.stringify(logData));
|
||||
|
||||
modulesManager.useProtocol(tunnel);
|
||||
BBB.initConnectionManager().useProtocol(tunnel);
|
||||
modulesManager.startUserServices();
|
||||
}
|
||||
|
||||
@ -58,15 +59,15 @@ package org.bigbluebutton.main.model.modules
|
||||
}
|
||||
|
||||
public function getPortTestHost():String {
|
||||
return modulesManager.portTestHost;
|
||||
return BBB.initConnectionManager().portTestHost;
|
||||
}
|
||||
|
||||
public function getPortTestApplication():String {
|
||||
return modulesManager.portTestApplication;
|
||||
return BBB.initConnectionManager().portTestApplication;
|
||||
}
|
||||
|
||||
public function getPortTestTimeout():Number {
|
||||
return modulesManager.portTestTimeout;
|
||||
return BBB.initConnectionManager().portTestTimeout;
|
||||
}
|
||||
|
||||
public function handleConfigLoaded():void {
|
||||
@ -78,13 +79,13 @@ package org.bigbluebutton.main.model.modules
|
||||
}
|
||||
|
||||
public function testRTMP():void{
|
||||
portTestProxy.connect(false /*"RTMP"*/, getPortTestHost(), "1935", getPortTestApplication(), getPortTestTimeout());
|
||||
portTestProxy.connect(false /*tunnel*/, getPortTestHost(), "", getPortTestApplication(), getPortTestTimeout());
|
||||
}
|
||||
|
||||
public function testRTMPT(tunnel:Boolean):void {
|
||||
if (!tunnel) {
|
||||
// Try to test using rtmpt as rtmp failed.
|
||||
portTestProxy.connect(true /*"RTMPT"*/, getPortTestHost(), "", getPortTestApplication(), getPortTestTimeout());
|
||||
portTestProxy.connect(true /*tunnel*/, getPortTestHost(), "", getPortTestApplication(), getPortTestTimeout());
|
||||
} else {
|
||||
modulesDispatcher.sendTunnelingFailedEvent(getPortTestHost(), getPortTestApplication());
|
||||
}
|
||||
|
2
bigbluebutton-client/src/org/bigbluebutton/main/model/options/PortTestOptions.as
Normal file → Executable file
2
bigbluebutton-client/src/org/bigbluebutton/main/model/options/PortTestOptions.as
Normal file → Executable file
@ -29,7 +29,7 @@ package org.bigbluebutton.main.model.options {
|
||||
|
||||
[Bindable]
|
||||
public var timeout:int = 10000;
|
||||
|
||||
|
||||
public function PortTestOptions() {
|
||||
name = "porttest";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user