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

cdutz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git


The following commit(s) were added to refs/heads/master by this push:
     new 8bee29f  Made the protocol able to react on unresponsive clients.
8bee29f is described below

commit 8bee29ff38e3dffddb73fb04fdd3ab20805fd772
Author: Christofer Dutz <christofer.d...@c-ware.de>
AuthorDate: Fri Apr 13 17:13:03 2018 +0200

    Made the protocol able to react on unresponsive clients.
---
 .../main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
 
b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
index 80467c4..5a277e3 100644
--- 
a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
+++ 
b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
@@ -108,12 +108,14 @@ public class Plc4XS7Protocol extends 
PlcMessageToMessageCodec<S7Message, PlcRequ
                     
requestContainer.getResponseFuture().completeExceptionally(cause);
                 }
             }
-        } else if((cause instanceof IOException) && 
cause.getMessage().contains("Connection reset by peer")) {
+        } else if((cause instanceof IOException) && 
(cause.getMessage().contains("Connection reset by peer") ||
+                cause.getMessage().contains("Operation timed out"))) {
+            String reason = cause.getMessage().contains("Connection reset by 
peer") ?
+                "Connection terminated unexpectedly" : "Remote host not 
responding";
             if (!requests.isEmpty()) {
                 // If the connection is hung up, all still pending requests 
can be closed.
                 for (PlcRequestContainer requestContainer : requests.values()) 
{
-                    requestContainer.getResponseFuture().completeExceptionally(
-                        new PlcIoException("Connection terminated 
unexpectedly"));
+                    
requestContainer.getResponseFuture().completeExceptionally(new 
PlcIoException(reason));
                 }
                 // Clear the list
                 requests.clear();

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

Reply via email to