Skip to content

Commit

Permalink
Merge pull request #50 from Red5/bug/RPRO-8658
Browse files Browse the repository at this point in the history
Bug/rpro 8658
  • Loading branch information
mondain authored Jul 22, 2021
2 parents 44d5831 + bd2957d commit 5562225
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
<url>https://oss.sonatype.org/content/repositories/releases</url>
</repository>
</repositories>
<version>1.2.9</version>
<properties>
<red5.version>1.2.8</red5.version>
</properties>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
Expand Down Expand Up @@ -118,7 +122,7 @@
<dependency>
<groupId>org.red5</groupId>
<artifactId>red5-server-common</artifactId>
<version>${project.version}</version>
<version>${red5.version}</version>
</dependency>
<dependency>
<groupId>org.apache.mina</groupId>
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/red5/client/net/rtmp/RTMPClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
* @author Jon Valliere
*/
public class RTMPClient extends BaseRTMPClientHandler {

private static final Logger log = LoggerFactory.getLogger(RTMPClient.class);

protected static final int CONNECTOR_WORKER_TIMEOUT = 7000; // seconds
protected static final int CONNECTOR_WORKER_TIMEOUT = 7000; // milliseconds

// I/O handler
protected final RTMPMinaIoHandler ioHandler;
Expand Down Expand Up @@ -137,5 +136,4 @@ public void setProtocol(String protocol) throws Exception {
throw new Exception("Unsupported protocol specified, please use the correct client for the intended protocol.");
}
}

}
33 changes: 33 additions & 0 deletions src/main/java/org/red5/client/net/rtmps/RTMPSClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@

package org.red5.client.net.rtmps;

import java.net.InetSocketAddress;

import javax.net.ssl.SSLContext;

import org.apache.mina.core.future.IoFuture;
import org.apache.mina.core.future.IoFutureListener;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.ssl.SslFilter;
import org.apache.mina.transport.socket.nio.NioSocketConnector;
import org.red5.client.net.rtmp.RTMPClient;
import org.red5.client.net.rtmp.RTMPMinaIoHandler;
import org.red5.client.net.ssl.BogusSslContextFactory;
Expand Down Expand Up @@ -56,6 +61,34 @@ public RTMPSClient() {
ioHandler.setHandler(this);
}

@SuppressWarnings({ "rawtypes" })
@Override
protected void startConnector(String server, int port) {
socketConnector = new NioSocketConnector();
socketConnector.setHandler(ioHandler);
future = socketConnector.connect(new InetSocketAddress(server, port));
future.addListener(new IoFutureListener() {
@Override
public void operationComplete(IoFuture future) {
try {
// will throw RuntimeException after connection error
future.getSession();
} catch (Throwable e) {
//if there isn't an ClientExceptionHandler set, a
//RuntimeException may be thrown in handleException
handleException(e);
}
}
});
// Do the close requesting that the pending messages are sent before
// the session is closed
//future.getSession().close(false);
// Now wait for the close to be completed
future.awaitUninterruptibly(CONNECTOR_WORKER_TIMEOUT);
// We can now dispose the connector
//socketConnector.dispose();
}

/**
* Password used to access the keystore file.
*
Expand Down

0 comments on commit 5562225

Please sign in to comment.