|
CPN
Computational Process Networks
|
#include <ConnectionServer.h>
Collaboration diagram for CPN::ConnectionServer:Classes | |
| class | PendingConnection |
Public Member Functions | |
| ConnectionServer (SockAddrList addrs, shared_ptr< Context > ctx) | |
| void | Poll () |
| void | Wakeup () |
| void | Close () |
| shared_ptr< Sync::Future< int > > | ConnectWriter (Key_t writerkey) |
| shared_ptr< Sync::Future< int > > | ConnectReader (Key_t readerkey) |
| SocketAddress | GetAddress () |
| void | Disable () |
| void | Enable () |
| void | LogState () |
Private Types | |
| typedef std::multimap< Key_t, shared_ptr< PendingConnection > > | PendingMap |
Private Member Functions | |
| void | PendingDone (Key_t key, PendingConnection *conn) |
Private Attributes | |
| PthreadMutex | lock |
| shared_ptr< Context > | context |
| Logger | logger |
| ServerSocketHandle | server |
| WakeupHandle | wakeup |
| PendingMap | pendingconnections |
| bool | enabled |
The connnection server takes ownership of the listening socket and accepts new connections. It also has all the logic for creating new connections. When remote is active in the Kernel, the Kernel creates a connection server and all RemoteQueues receive a reference to it as well.
Definition at line 41 of file ConnectionServer.h.
|
private |
Definition at line 106 of file ConnectionServer.h.
| CPN::ConnectionServer::ConnectionServer | ( | SockAddrList | addrs, |
| shared_ptr< Context > | ctx | ||
| ) |
| addrs | list of socket addresses to use to listen on |
| ctx | the context which contains all the data connection data. |
Definition at line 37 of file ConnectionServer.cc.
References ServerSocketHandle::Listen(), and server.
Here is the call graph for this function:| void CPN::ConnectionServer::Close | ( | ) |
Close the listening socket and shutdown the connection server.
Definition at line 92 of file ConnectionServer.cc.
References FileHandle::Close(), lock, pendingconnections, and server.
Here is the call graph for this function:| shared_ptr< Sync::Future< int > > CPN::ConnectionServer::ConnectReader | ( | Key_t | readerkey | ) |
Request the connection server connect the RemoteQueue which has key readerkey to its other endpoint.
| readerkey | the key for the reader of this queue |
Definition at line 134 of file ConnectionServer.cc.
References FileHandle::Closed(), lock, pendingconnections, and server.
Referenced by CPN::RemoteQueue::FileThreadEntryPoint().
Here is the call graph for this function:
Here is the caller graph for this function:| shared_ptr< Sync::Future< int > > CPN::ConnectionServer::ConnectWriter | ( | Key_t | writerkey | ) |
Request the connectino server to connect the RemoteQueue which has key writekey to its other endpoint.
| writerkey | the writekey of the endpoint. |
Definition at line 102 of file ConnectionServer.cc.
References FileHandle::Closed(), SocketHandle::Connect(), context, SocketAddress::CreateIP(), enabled, FileHandle::FD(), CPN::Packet::header, lock, CPN::PACKET_ID_WRITER, pendingconnections, FileHandle::Reset(), server, CPN::Packet::SourceKey(), AutoLock< Lockable >::Unlock(), and FileHandle::Write().
Referenced by CPN::RemoteQueue::FileThreadEntryPoint().
Here is the call graph for this function:
Here is the caller graph for this function:| void CPN::ConnectionServer::Disable | ( | ) |
These functions are for testing and debugging. They should only be called from the unit tests or from the debugger.
Definition at line 156 of file ConnectionServer.cc.
| void CPN::ConnectionServer::Enable | ( | ) |
Definition at line 161 of file ConnectionServer.cc.
References enabled, lock, and pendingconnections.
| SocketAddress CPN::ConnectionServer::GetAddress | ( | ) |
Definition at line 150 of file ConnectionServer.cc.
References FileHandle::FD(), server, and SocketAddress::SetFromSockName().
Here is the call graph for this function:| void CPN::ConnectionServer::LogState | ( | ) |
Definition at line 171 of file ConnectionServer.cc.
References FileHandle::Closed(), enabled, Logger::Error(), logger, pendingconnections, and server.
Here is the call graph for this function:
|
private |
Definition at line 181 of file ConnectionServer.cc.
References lock, and pendingconnections.
| void CPN::ConnectionServer::Poll | ( | void | ) |
Poll is periodically called by the Kernel to accept new connections.
Definition at line 43 of file ConnectionServer.cc.
References ServerSocketHandle::Accept(), ErrnoException::Error(), Logger::Error(), lock, logger, CPN::PACKET_ID_READER, CPN::PACKET_ID_WRITER, pendingconnections, FileHandle::Poll(), WakeupHandle::Read(), FileHandle::Readable(), server, wakeup, and ErrnoException::what().
Here is the call graph for this function:
|
inline |
A call to Wakeup will cause Poll to return even if no connections are accepted.
Definition at line 56 of file ConnectionServer.h.
Referenced by CPN::RemoteQueue::FileThreadEntryPoint().
Here is the caller graph for this function:
|
private |
Definition at line 108 of file ConnectionServer.h.
Referenced by ConnectWriter().
|
private |
Definition at line 113 of file ConnectionServer.h.
Referenced by ConnectWriter(), Disable(), Enable(), and LogState().
|
private |
Definition at line 107 of file ConnectionServer.h.
Referenced by Close(), ConnectReader(), ConnectWriter(), Disable(), Enable(), PendingDone(), and Poll().
|
private |
Definition at line 109 of file ConnectionServer.h.
Referenced by LogState(), and Poll().
|
private |
Definition at line 112 of file ConnectionServer.h.
Referenced by Close(), ConnectReader(), ConnectWriter(), Enable(), LogState(), PendingDone(), and Poll().
|
private |
Definition at line 110 of file ConnectionServer.h.
Referenced by Close(), ConnectionServer(), ConnectReader(), ConnectWriter(), CPN::ConnectionServer::PendingConnection::Get(), GetAddress(), LogState(), and Poll().
|
private |
Definition at line 111 of file ConnectionServer.h.
Referenced by Poll().
1.8.5