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:07:37 UTC

[camel] branch master 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 master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 6b96656  CAMEL-12358: Camel-SMPP: Use timeout when creating socket connection
6b96656 is described below

commit 6b9665637ad467c4d30cd04c28b4be4866d5ef4f
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.