[
https://issues.apache.org/jira/browse/CAMEL-12358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16403433#comment-16403433
]
ASF GitHub Bot commented on CAMEL-12358:
----------------------------------------
davsclaus closed pull request #2258: CAMEL-12358: Camel-SMPP: Use timeout when
creating socket connection
URL: https://github.com/apache/camel/pull/2258
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 cab3301617a..76e65fa113e 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.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 Connection createConnection(String host, int port)
throws IOException {
.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) {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Camel-SMPP: Use timeout when creating socket connection
> -------------------------------------------------------
>
> Key: CAMEL-12358
> URL: https://issues.apache.org/jira/browse/CAMEL-12358
> Project: Camel
> Issue Type: Improvement
> Components: camel-smpp
> Reporter: Pascal Schumacher
> Assignee: Pascal Schumacher
> Priority: Major
>
> Camel-SMPP is using
> _javax.net.SocketFactory#createSocket(String host, int port)_ which "creates
> a socket and connects it to the specified port number at the specified
> address" according to the javadoc.
> As _SocketFactory_ is an abstract class, the behavior of _createSocket(String
> host, int port)_ depends on the concrete implementation in use, but at least
> the default implementation of Oracle Java 8 Update 152 connects without using
> a timeout.
> As blocking operations without timeouts should be avoided Camel-SMPP should
> use a timeout when connecting the socket.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)