remove uneeded log
[nikiroo-utils.git] / src / be / nikiroo / utils / serial / server / Server.java
index f6dd7d86a13cbf94c4c08279458ae3724b8b2f5b..2f23c288388bbc82315672dc3e375c39ec3622cc 100644 (file)
@@ -38,6 +38,9 @@ abstract class Server implements Runnable {
        private boolean exiting = false;
        private int counter;
 
+       private long bytesReceived;
+       private long bytesSent;
+
        private TraceHandler tracer = new TraceHandler();
 
        /**
@@ -146,6 +149,24 @@ abstract class Server implements Runnable {
                return port;
        }
 
+       /**
+        * The total amount of bytes received.
+        * 
+        * @return the amount of bytes received
+        */
+       public long getBytesReceived() {
+               return bytesReceived;
+       }
+
+       /**
+        * The total amount of bytes sent.
+        * 
+        * @return the amount of bytes sent
+        */
+       public long getBytesSent() {
+               return bytesSent;
+       }
+
        /**
         * Start the server (listen on the network for new connections).
         * <p>
@@ -194,25 +215,22 @@ abstract class Server implements Runnable {
                        tracer.trace(name + ": server starting on port " + port + " ("
                                        + (ssl ? "SSL" : "plain text") + ")");
 
-                       String ciphers = "";
-                       for (String cipher : getAnonCiphers()) {
-                               if (!ciphers.isEmpty()) {
-                                       ciphers += ", ";
-                               }
-                               ciphers += cipher;
-                       }
-                       tracer.trace("Available SSL ciphers: " + ciphers);
-
                        while (started && !exiting) {
                                count(1);
                                final Socket s = ss.accept();
                                new Thread(new Runnable() {
                                        @Override
                                        public void run() {
+                                               ConnectActionServer action = null;
                                                try {
-                                                       createConnectActionServer(s).connect();
+                                                       action = createConnectActionServer(s);
+                                                       action.connect();
                                                } finally {
                                                        count(-1);
+                                                       if (action != null) {
+                                                               bytesReceived += action.getBytesReceived();
+                                                               bytesSent += action.getBytesSent();
+                                                       }
                                                }
                                        }
                                }).start();