You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2013/05/20 19:12:00 UTC

[1/4] git commit: o Changed the size of the UDP packet we send, as the default OS maximum datagram size is 9219 bytes o

Updated Branches:
  refs/heads/trunk 2ac9a8567 -> 08cd021ea


o Changed the size of the UDP packet we send, as the default OS maximum
datagram size is 9219 bytes
o 

Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/3806ed9f
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/3806ed9f
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/3806ed9f

Branch: refs/heads/trunk
Commit: 3806ed9fb90872da5b14b68c2457e36f99c84dbc
Parents: d45add2
Author: Emmanuel Lécharny <el...@apache.org>
Authored: Sun May 19 20:42:06 2013 +0200
Committer: Emmanuel Lécharny <el...@apache.org>
Committed: Sun May 19 20:42:06 2013 +0200

----------------------------------------------------------------------
 ...oClientVsMina3ServerUdpBenchmarkBinaryTest.java |    9 +++++++--
 ...3ClientVsMina3ServerUdpBenchmarkBinaryTest.java |    7 ++++---
 ...3ClientVsMina3ServerUdpBenchmarkBinaryTest.java |    7 ++++---
 ...ClientVsNetty3ServerUdpBenchmarkBinaryTest.java |    7 ++++---
 4 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/3806ed9f/benchmarks/src/test/java/org/apache/mina/core/BioClientVsMina3ServerUdpBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/BioClientVsMina3ServerUdpBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/BioClientVsMina3ServerUdpBenchmarkBinaryTest.java
index bb0f467..25d1980 100644
--- a/benchmarks/src/test/java/org/apache/mina/core/BioClientVsMina3ServerUdpBenchmarkBinaryTest.java
+++ b/benchmarks/src/test/java/org/apache/mina/core/BioClientVsMina3ServerUdpBenchmarkBinaryTest.java
@@ -56,8 +56,13 @@ public class BioClientVsMina3ServerUdpBenchmarkBinaryTest extends BenchmarkBinar
 
     @Parameters(name = "{0} messages of size {1}")
     public static Collection<Object[]> getParameters() {
-        Object[][] parameters = new Object[][] { { 1000000, 10, 2 * 60 }, { 1000000, 1 * 1024, 2 * 60 },
-                { 1000000, 10 * 1024, 2 * 60 }, { 1000000, 20 * 1024, 2 * 60 }, { 500000, 50 * 1024, 2 * 60 } }; // No need to test any further, the maximum size for an UDP message is 64Kb
+        // Note : depending on your OS, the maximum PDU you can send can vary. See sysctl net.inet.udp.maxdgram
+        Object[][] parameters = new Object[][] { 
+                { 1000000, 10, 2 * 60 }, 
+                { 1000000, 1 * 1024, 2 * 60 },
+                { 1000000, 2 * 1024, 2 * 60 }, 
+                { 1000000, 4 * 1024, 2 * 60 }, 
+                { 500000, 8 * 1024, 2 * 60 } }; // No need to test any further, the maximum size for an UDP message is 64Kb
         return Arrays.asList(parameters);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina/blob/3806ed9f/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
index 30b941d..57dd6ca 100644
--- a/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
+++ b/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
@@ -56,12 +56,13 @@ public class Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest extends BenchmarkBin
 
     @Parameters(name = "{0} messages of size {1}")
     public static Collection<Object[]> getParameters() {
+        // Note : depending on your OS, the maximum PDU you can send can vary. See sysctl net.inet.udp.maxdgram
         Object[][] parameters = new Object[][] { 
                 { 1000000, 10, 2 * 60 }, 
                 { 1000000, 1 * 1024, 2 * 60 },
-                { 1000000, 10 * 1024, 2 * 60 }, 
-                { 1000000, 20 * 1024, 2 * 60 }, 
-                { 500000, 50 * 1024, 2 * 60 }}; // No need to test any further, the maximum size for an UDP message is 64Kb
+                { 1000000, 2 * 1024, 2 * 60 }, 
+                { 1000000, 4 * 1024, 2 * 60 }, 
+                { 500000, 8 * 1024, 2 * 60 }}; // No need to test any further, the maximum size for an UDP message is 64Kb
         return Arrays.asList(parameters);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina/blob/3806ed9f/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsMina3ServerUdpBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
index 1c2c518..13b74ab 100644
--- a/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
+++ b/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
@@ -54,12 +54,13 @@ public class Netty3ClientVsMina3ServerUdpBenchmarkBinaryTest extends BenchmarkBi
 
     @Parameters(name = "{0} messages of size {1}")
     public static Collection<Object[]> getParameters() {
+        // Note : depending on your OS, the maximum PDU you can send can vary. See sysctl net.inet.udp.maxdgram
         Object[][] parameters = new Object[][] {
                 { 1000000, 10, 2 * 60 } , 
                 { 1000000, 1 * 1024, 2 * 60 },
-                { 1000000, 10 * 1024, 2 * 60 }, 
-                { 1000000, 20 * 1024, 2 * 60 }, 
-                { 500000, 50 * 1024, 2 * 60 }}; // No need to test any further, the maximum size for an UDP message is 64Kb
+                { 1000000, 2 * 1024, 2 * 60 }, 
+                { 1000000, 4 * 1024, 2 * 60 }, 
+                { 500000, 8 * 1024, 2 * 60 }}; // No need to test any further, the maximum size for an UDP message is 64Kb
         return Arrays.asList(parameters);
     }
 }

http://git-wip-us.apache.org/repos/asf/mina/blob/3806ed9f/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsNetty3ServerUdpBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git a/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsNetty3ServerUdpBenchmarkBinaryTest.java b/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsNetty3ServerUdpBenchmarkBinaryTest.java
index 8e026c6..5b0c74b 100644
--- a/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsNetty3ServerUdpBenchmarkBinaryTest.java
+++ b/benchmarks/src/test/java/org/apache/mina/core/Netty3ClientVsNetty3ServerUdpBenchmarkBinaryTest.java
@@ -54,12 +54,13 @@ public class Netty3ClientVsNetty3ServerUdpBenchmarkBinaryTest extends BenchmarkB
 
     @Parameters(name = "{0} messages of size {1}")
     public static Collection<Object[]> getParameters() {
+        // Note : depending on your OS, the maximum PDU you can send can vary. See sysctl net.inet.udp.maxdgram
         Object[][] parameters = new Object[][] { 
                 { 1000000, 10, 2 * 60 }, 
                 { 1000000, 1 * 1024, 2 * 60 },
-                { 1000000, 10 * 1024, 2 * 60 }, 
-                { 1000000, 20 * 1024, 2 * 60 }, 
-                { 500000, 50 * 1024, 2 * 60 }}; // No need to test any further, the maximum size for an UDP message is 64Kb
+                { 1000000, 2 * 1024, 2 * 60 }, 
+                { 1000000, 4 * 1024, 2 * 60 }, 
+                { 500000, 8 * 1024, 2 * 60 }}; // No need to test any further, the maximum size for an UDP message is 64Kb
         return Arrays.asList(parameters);
     }
 }


[2/4] git commit: Merge branch 'trunk' of http://git-wip-us.apache.org/repos/asf/mina into trunk

Posted by el...@apache.org.
Merge branch 'trunk' of http://git-wip-us.apache.org/repos/asf/mina into trunk


Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/58c065d1
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/58c065d1
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/58c065d1

Branch: refs/heads/trunk
Commit: 58c065d176e20fe158ac0818a676133e539166a2
Parents: 3806ed9 2ac9a85
Author: Emmanuel Lécharny <el...@apache.org>
Authored: Mon May 20 13:54:09 2013 +0200
Committer: Emmanuel Lécharny <el...@apache.org>
Committed: Mon May 20 13:54:09 2013 +0200

----------------------------------------------------------------------
 .../mina/session/DefaultAttributeContainer.java    |  154 ++++--------
 .../mina/transport/nio/udp/NioUdpSession.java      |   20 +-
 .../transport/udp/NioUdpClientFilterEventTest.java |  195 +++++++++++++++
 3 files changed, 255 insertions(+), 114 deletions(-)
----------------------------------------------------------------------



[3/4] git commit: Removed a parameter affectation

Posted by el...@apache.org.
Removed a parameter affectation

Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/ba2907c4
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/ba2907c4
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/ba2907c4

Branch: refs/heads/trunk
Commit: ba2907c464d4e2e5e1ddd186af678e3b83c4073f
Parents: 58c065d
Author: Emmanuel Lécharny <el...@apache.org>
Authored: Mon May 20 13:55:23 2013 +0200
Committer: Emmanuel Lécharny <el...@apache.org>
Committed: Mon May 20 13:55:23 2013 +0200

----------------------------------------------------------------------
 .../apache/mina/codec/delimited/ints/VarInt.java   |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/ba2907c4/codec/src/main/java/org/apache/mina/codec/delimited/ints/VarInt.java
----------------------------------------------------------------------
diff --git a/codec/src/main/java/org/apache/mina/codec/delimited/ints/VarInt.java b/codec/src/main/java/org/apache/mina/codec/delimited/ints/VarInt.java
index 23eb3ef..625afeb 100644
--- a/codec/src/main/java/org/apache/mina/codec/delimited/ints/VarInt.java
+++ b/codec/src/main/java/org/apache/mina/codec/delimited/ints/VarInt.java
@@ -128,13 +128,13 @@ public class VarInt {
 
         @Override
         public void writeTo(Integer message, ByteBuffer buffer) {
+            int value = message;
+
             // VarInts don't support negative values
-            if (message < 0) {
-                message = 0;
+            if (value < 0) {
+                value = 0;
             }
 
-            int value = message;
-
             while (value > 0x7f) {
                 buffer.put((byte) ((value & 0x7f) | 0x80));
                 value >>= 7;


[4/4] git commit: o Added some missing javadoc o Correctly initialize the session config buffers using the connected socket

Posted by el...@apache.org.
o Added some missing javadoc
o Correctly initialize the session config buffers using the connected
socket

Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/08cd021e
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/08cd021e
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/08cd021e

Branch: refs/heads/trunk
Commit: 08cd021eaf7e7bc737a6690e559fde014e6b9624
Parents: ba2907c
Author: Emmanuel Lécharny <el...@apache.org>
Authored: Mon May 20 19:11:25 2013 +0200
Committer: Emmanuel Lécharny <el...@apache.org>
Committed: Mon May 20 19:11:25 2013 +0200

----------------------------------------------------------------------
 .../mina/transport/nio/tcp/NioTcpClient.java       |    6 ++++++
 .../mina/transport/nio/udp/NioUdpClient.java       |   10 ++++++++--
 .../mina/transport/udp/AbstractUdpClient.java      |    2 +-
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/08cd021e/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpClient.java b/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpClient.java
index fce1a2f..be35a62 100644
--- a/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpClient.java
+++ b/core/src/main/java/org/apache/mina/transport/nio/tcp/NioTcpClient.java
@@ -159,12 +159,18 @@ public class NioTcpClient extends AbstractTcpClient {
 
         if (receiveBufferSize != null) {
             session.getConfig().setReadBufferSize(receiveBufferSize);
+        } else {
+            int rcvBufferSize = clientSocket.socket().getReceiveBufferSize();
+            session.getConfig().setReadBufferSize(rcvBufferSize);
         }
 
         Integer sendBufferSize = config.getSendBufferSize();
 
         if (sendBufferSize != null) {
             session.getConfig().setSendBufferSize(sendBufferSize);
+        } else {
+            int sndBufferSize = clientSocket.socket().getSendBufferSize();
+            session.getConfig().setSendBufferSize(sndBufferSize);
         }
 
         Integer trafficClass = config.getTrafficClass();

http://git-wip-us.apache.org/repos/asf/mina/blob/08cd021e/core/src/main/java/org/apache/mina/transport/nio/udp/NioUdpClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/transport/nio/udp/NioUdpClient.java b/core/src/main/java/org/apache/mina/transport/nio/udp/NioUdpClient.java
index 9ab4338..1abe479 100644
--- a/core/src/main/java/org/apache/mina/transport/nio/udp/NioUdpClient.java
+++ b/core/src/main/java/org/apache/mina/transport/nio/udp/NioUdpClient.java
@@ -79,7 +79,7 @@ public class NioUdpClient extends AbstractUdpClient {
 
         NioSelectorLoop loop = (NioSelectorLoop) readWriteSelectorPool.getSelectorLoop();
 
-        final NioUdpSession session = new NioUdpSession(this, idleChecker, ch, null, remoteAddress, loop);
+        NioUdpSession session = new NioUdpSession(this, idleChecker, ch, null, remoteAddress, loop);
 
         session.setConnected();
 
@@ -104,12 +104,18 @@ public class NioUdpClient extends AbstractUdpClient {
 
         if (readBufferSize != null) {
             session.getConfig().setReadBufferSize(readBufferSize);
+        } else {
+            int rcvBufferSize = ch.socket().getReceiveBufferSize();
+            session.getConfig().setReadBufferSize(rcvBufferSize);
         }
 
         Integer sendBufferSize = config.getSendBufferSize();
 
         if (sendBufferSize != null) {
             session.getConfig().setSendBufferSize(sendBufferSize);
+        } else {
+            int sndBufferSize = ch.socket().getSendBufferSize();
+            session.getConfig().setSendBufferSize(sndBufferSize);
         }
 
         Integer trafficClass = config.getTrafficClass();
@@ -122,6 +128,7 @@ public class NioUdpClient extends AbstractUdpClient {
 
         ConnectFuture cf = new ConnectFuture();
         cf.complete(session);
+
         return cf;
     }
 
@@ -132,5 +139,4 @@ public class NioUdpClient extends AbstractUdpClient {
     public IoFuture<IoSession> connect(SocketAddress remoteAddress, SocketAddress localAddress) {
         throw new IllegalStateException("not supported for UDP");
     }
-
 }

http://git-wip-us.apache.org/repos/asf/mina/blob/08cd021e/core/src/main/java/org/apache/mina/transport/udp/AbstractUdpClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/transport/udp/AbstractUdpClient.java b/core/src/main/java/org/apache/mina/transport/udp/AbstractUdpClient.java
index ec57016..a8d9747 100644
--- a/core/src/main/java/org/apache/mina/transport/udp/AbstractUdpClient.java
+++ b/core/src/main/java/org/apache/mina/transport/udp/AbstractUdpClient.java
@@ -29,7 +29,7 @@ import org.apache.mina.service.client.AbstractIoClient;
 import org.apache.mina.service.executor.IoHandlerExecutor;
 
 /**
- * TODO
+ * Base class for UDP based Clients
  * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */