Author: veithm
Date: Fri May 15 15:08:29 2015
New Revision: 1679590

URL: http://svn.apache.org/r1679590
Log:
Add notification signaling tcp listener shutdown

The newly added signal informs all open connections that the listener
is about the close.
This is especially useful in order to shut down all connections gracefully.

Change-Id: Ie52a89d2d5671034ec62a02654351dd240302f2d

Modified:
    etch/trunk/binding-cpp/runtime/include/transport/EtchTcpListener.h
    etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp

Modified: etch/trunk/binding-cpp/runtime/include/transport/EtchTcpListener.h
URL: 
http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpListener.h?rev=1679590&r1=1679589&r2=1679590&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/transport/EtchTcpListener.h 
(original)
+++ etch/trunk/binding-cpp/runtime/include/transport/EtchTcpListener.h Fri May 
15 15:08:29 2015
@@ -124,7 +124,7 @@ public:
   const static EtchString& BACKLOG();
 
   const static EtchString& CONNECTION_CHECK();
-
+  const static EtchString& CONNECTION_SHUTDOWN();
 private:
   class ConnectionChecker : public capu::Runnable {
   public:

Modified: etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp
URL: 
http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp?rev=1679590&r1=1679589&r2=1679590&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp 
(original)
+++ etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp Fri 
May 15 15:08:29 2015
@@ -36,6 +36,13 @@ void EtchTcpListener::ConnectionChecker:
       capu::Thread::Sleep(1000);
     }
   }
+  if (mListener->mSession != NULL) {
+      result = mListener->mSession->sessionNotify(new 
EtchString(EtchTcpListener::CONNECTION_SHUTDOWN()));
+      if (result != ETCH_OK) {
+          //TODO handle error
+      }
+  }
+
 }
 
 const EtchString& EtchTcpListener::BACKLOG() {
@@ -48,6 +55,11 @@ const EtchString& EtchTcpListener::CONNE
   return name;
 }
 
+const EtchString& EtchTcpListener::CONNECTION_SHUTDOWN() {
+    static const EtchString name("connection.shutdown");
+    return name;
+}
+
 EtchTcpListener::EtchTcpListener(EtchRuntime* runtime, EtchURL *url)
 : mRuntime(runtime), mPort(url->getPort()) {
   EtchString str;


Reply via email to