diff options
Diffstat (limited to 'src/Net/Connection.h')
-rw-r--r-- | src/Net/Connection.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/Net/Connection.h b/src/Net/Connection.h index add10b7..64b12c6 100644 --- a/src/Net/Connection.h +++ b/src/Net/Connection.h @@ -80,6 +80,8 @@ class MAD_NET_EXPORT Connection : boost::noncopyable { Core::Signals::Signal0 connectedSignal; Core::Signals::Signal0 disconnectedSignal; + boost::uint32_t receiveLimit; + bool receiving; unsigned long sending; @@ -138,7 +140,8 @@ class MAD_NET_EXPORT Connection : boost::noncopyable { application(application0), state(DISCONNECTED), dontStart(false), receiveBuffer(new boost::array<boost::uint8_t, 1024*1024>), receiveSignal(application), connectedSignal(application), - disconnectedSignal(application), context(context0), socket(application->getIOService(), *context) {} + disconnectedSignal(application), receiveLimit(0xFFFF) /* 64K */, receiving(false), sending(0), + context(context0), socket(application->getIOService(), *context) {} static boost::shared_ptr<Connection> create(Core::Application *application, boost::shared_ptr<boost::asio::ssl::context> context) { boost::shared_ptr<Connection> connection(new Connection(application, context)); @@ -180,17 +183,6 @@ class MAD_NET_EXPORT Connection : boost::noncopyable { stateChanged.wait(lock); } - /*const gnutls_datum_t* getCertificate() const { - // TODO Thread-safeness - return gnutls_certificate_get_ours(session); - } - - const gnutls_datum_t* getPeerCertificate() const { - // TODO Thread-safeness - unsigned int n; - return gnutls_certificate_get_peers(session, &n); - }*/ - boost::asio::ip::tcp::endpoint getPeer() { boost::shared_lock<boost::shared_mutex> lock(connectionLock); return peer; @@ -206,6 +198,16 @@ class MAD_NET_EXPORT Connection : boost::noncopyable { setStart(false); } + boost::uint32_t getReceiveLimit() { + boost::shared_lock<boost::shared_mutex> lock(connectionLock); + return receiveLimit; + } + + void setReceiveLimit(boost::uint32_t limit) { + boost::lock_guard<boost::shared_mutex> lock(connectionLock); + receiveLimit = limit; + } + void startReceive() { { boost::lock_guard<boost::shared_mutex> lock(connectionLock); |