You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/03/17 13:09:23 UTC

[camel] branch camel-2.19.x updated: CAMEL-12358: Camel-SMPP: Use timeout when creating socket connection

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.19.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.19.x by this push:
     new 215ed9c  CAMEL-12358: Camel-SMPP: Use timeout when creating socket connection
215ed9c is described below

commit 215ed9c9a74e5b37f1f812e31fd4623a463aedf5
Author: Pascal Schumacher <pa...@gmx.net>
AuthorDate: Fri Mar 16 19:24:32 2018 +0100

    CAMEL-12358: Camel-SMPP: Use timeout when creating socket connection
---
 .../org/apache/camel/component/smpp/SmppConnectionFactory.java   | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java
index cab3301..76e65fa 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java
@@ -52,6 +52,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.net.InetSocketAddress;
 import java.net.Socket;
 
 import java.util.Map;
@@ -90,10 +91,14 @@ public final class SmppConnectionFactory implements ConnectionFactory {
                 .getDefault() : SocketFactory.getDefault();
             if (config.getHttpProxyHost() != null) {
                 // setup the proxy tunnel
-                socket = socketFactory.createSocket(config.getHttpProxyHost(), config.getHttpProxyPort());
+                socket = socketFactory.createSocket();
+                // jsmpp uses enquire link timer as socket read timeout, so also use it to establish the initial connection
+                socket.connect(new InetSocketAddress(config.getHttpProxyHost(), config.getHttpProxyPort()), config.getEnquireLinkTimer());
                 connectProxy(host, port, socket);
             } else {
-                socket = socketFactory.createSocket(host, port);
+                socket = socketFactory.createSocket();
+                // jsmpp uses enquire link timer as socket read timeout, so also use it to establish the initial connection
+                socket.connect(new InetSocketAddress(host, port), config.getEnquireLinkTimer());
             }
 
             if (config.getUsingSSL() && config.getHttpProxyHost() != null) {

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.