summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-11-15 07:01:56 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-11-15 07:01:56 +0100
commit174ac25d9788e5604ae37cf9048e307a97bbdff8 (patch)
treee613eef3f9078964dd3918c2b5fd35e6b146efd0 /common
parent6c56cfd9d0954dde4fa13d2c81ef3eb6f1881156 (diff)
Connection API changes.
Diffstat (limited to 'common')
-rw-r--r--common/connectionbase.cpp12
-rw-r--r--common/connectionbase.h9
2 files changed, 4 insertions, 17 deletions
diff --git a/common/connectionbase.cpp b/common/connectionbase.cpp
index 5dadf7d..c269349 100644
--- a/common/connectionbase.cpp
+++ b/common/connectionbase.cpp
@@ -4,15 +4,7 @@
#include <iostream>
-void ConnectionBase::prepare_next_message() {
- //next_message = make_shared<Message::Hello>();
-
- //request_data(next_message->deserialize(0, 0));
-}
-
-void ConnectionBase::connected() {
- std::cout << "Connection established." << std::endl;
-
+void ConnectionBase::start_recv() {
request_data(4);
}
@@ -67,8 +59,6 @@ void ConnectionBase::got_data(uint8_t* data, std::size_t bytes) {
}
got_message(m);
-
- request_data(4);
}
void ConnectionBase::send(const Message::p& msg) {
diff --git a/common/connectionbase.h b/common/connectionbase.h
index 3e64551..ef09f83 100644
--- a/common/connectionbase.h
+++ b/common/connectionbase.h
@@ -11,13 +11,10 @@ class ConnectionBase {
private:
Message::Type pending_type;
std::size_t pending_size;
-
- //! Create a new message and initiate reception.
- void prepare_next_message();
-
+
protected:
- //! Signal that connection is established and ready to transfer data.
- void connected();
+ //! Initiate reception of a message.
+ void start_recv();
//! Deliver received data.
//! \param data Pointer to received data. Ownership is retained by caller.