changeset 1239:ce9ac16deb77

SocketParameters.linger == 0 support
author Devel 2
date Tue, 30 Jun 2020 12:11:50 +0200
parents 457d050a95f6
children f082bcb89613
files stress-tester/src/main/java/com/passus/st/config/SocketParametersNodeDefCreator.java stress-tester/src/main/java/com/passus/st/emitter/SocketParameters.java
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/config/SocketParametersNodeDefCreator.java	Tue Jun 30 12:02:17 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/config/SocketParametersNodeDefCreator.java	Tue Jun 30 12:11:50 2020 +0200
@@ -5,8 +5,7 @@
 
 import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef;
 import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef;
-import static com.passus.st.config.CommonNodeDefs.BOOLEAN_DEF;
-import static com.passus.st.config.CommonNodeDefs.INT_GREATER_THAN_ZERO_DEF;
+import static com.passus.st.config.CommonNodeDefs.*;
 
 public class SocketParametersNodeDefCreator implements NodeDefinitionCreator {
 
@@ -15,7 +14,7 @@
         return mapDef(
                 tupleDef("broadcast", BOOLEAN_DEF).setRequired(false),
                 tupleDef("keepalive", BOOLEAN_DEF).setRequired(false),
-                tupleDef("linger", INT_GREATER_THAN_ZERO_DEF).setRequired(false),
+                tupleDef("linger", INT_GREATER_EQUAL_ZERO_DEF).setRequired(false),
                 tupleDef("sendbuffersize", INT_GREATER_THAN_ZERO_DEF).setRequired(false),
                 tupleDef("receivebuffersize", INT_GREATER_THAN_ZERO_DEF).setRequired(false)
         ).setTransformer(new SocketParametersRuleNodeTransformer());
--- a/stress-tester/src/main/java/com/passus/st/emitter/SocketParameters.java	Tue Jun 30 12:02:17 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/emitter/SocketParameters.java	Tue Jun 30 12:11:50 2020 +0200
@@ -128,7 +128,7 @@
             channel.setOption(StandardSocketOptions.SO_KEEPALIVE, keepalive);
         }
 
-        if (linger > 0) {
+        if (linger >= 0) {
             channel.setOption(StandardSocketOptions.SO_LINGER, linger);
         }
     }