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

git-svn-id: https://svn.apache.org/repos/asf/etch/trunk@1679590 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/binding-cpp/runtime/include/transport/EtchTcpListener.h b/binding-cpp/runtime/include/transport/EtchTcpListener.h
index ded5f3b..239b56e 100644
--- a/binding-cpp/runtime/include/transport/EtchTcpListener.h
+++ b/binding-cpp/runtime/include/transport/EtchTcpListener.h
@@ -124,7 +124,7 @@
   const static EtchString& BACKLOG();
 
   const static EtchString& CONNECTION_CHECK();
-
+  const static EtchString& CONNECTION_SHUTDOWN();
 private:
   class ConnectionChecker : public capu::Runnable {
   public:
diff --git a/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp b/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp
index 51fc8f5..49f0862 100644
--- a/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp
+++ b/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp
@@ -36,6 +36,13 @@
       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 @@
   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;