Author: veithm
Date: Fri May 15 15:10:15 2015
New Revision: 1679594
URL: http://svn.apache.org/r1679594
Log:
Add method to shutdown all connections
All connections are closed and the method waits until the connection
threads are terminated.
Change-Id: I079d216bd7a101514fbe10b1f1542e7033f8ea6e
Modified:
etch/trunk/binding-cpp/runtime/include/transport/EtchConnection.h
etch/trunk/binding-cpp/runtime/include/transport/EtchTcpTransportFactory.h
etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp
Modified: etch/trunk/binding-cpp/runtime/include/transport/EtchConnection.h
URL:
http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/transport/EtchConnection.h?rev=1679594&r1=1679593&r2=1679594&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/transport/EtchConnection.h (original)
+++ etch/trunk/binding-cpp/runtime/include/transport/EtchConnection.h Fri May
15 15:10:15 2015
@@ -33,6 +33,8 @@ template <class S>
class EtchConnection : public virtual EtchTransport<S> {
public:
+ friend class EtchTcpTransportFactory;
+
/**
* Default Constructor
*/
Modified:
etch/trunk/binding-cpp/runtime/include/transport/EtchTcpTransportFactory.h
URL:
http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/transport/EtchTcpTransportFactory.h?rev=1679594&r1=1679593&r2=1679594&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/transport/EtchTcpTransportFactory.h
(original)
+++ etch/trunk/binding-cpp/runtime/include/transport/EtchTcpTransportFactory.h
Fri May 15 15:10:15 2015
@@ -136,6 +136,8 @@ private:
status_t sessionNotify(capu::SmartPointer<EtchObject> event);
private:
+ void shutdownAllConnections();
+
EtchRuntime* mRuntime;
EtchTcpTransportFactory* mFactory;
EtchTransport<EtchSessionListener<EtchSocket> > *mTransport;
Modified:
etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp
URL:
http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp?rev=1679594&r1=1679593&r2=1679594&view=diff
==============================================================================
---
etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp
(original)
+++
etch/trunk/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp
Fri May 15 15:10:15 2015
@@ -191,6 +191,24 @@ status_t EtchTcpTransportFactory::MySess
}
+void EtchTcpTransportFactory::MySessionListener::shutdownAllConnections()
+{
+ EtchList<EtchStack*>::Iterator it = mConnectionStacks->begin();
+ while (it.hasNext()) {
+ EtchStack* stack = NULL;
+ status_t res = it.current(stack);
+ if (res == ETCH_OK) {
+ EtchTcpConnection* con = (EtchTcpConnection*)
stack->getTransportData();
+ if (con != NULL) {
+ con->mIsStarted = false;
+ con->close();
+ con->mThread->join();
+ }
+ }
+ it.next();
+ }
+}
+
status_t
EtchTcpTransportFactory::MySessionListener::sessionAccepted(EtchSocket*
connection) {
if (connection == NULL) {
return ETCH_ERROR;