summaryrefslogtreecommitdiffstats
path: root/src/Common
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-05-15 17:30:40 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-05-15 17:30:40 +0200
commitc8d469cc3de8ef2fb95f7b47355ebf5318a4c22f (patch)
tree2cb0bd20306f89f3da11ff22b19865ed99225b2f /src/Common
parent8324b947487f72fd8cfc439ea5ae5bd1187fff1b (diff)
downloadmad-c8d469cc3de8ef2fb95f7b47355ebf5318a4c22f.tar
mad-c8d469cc3de8ef2fb95f7b47355ebf5318a4c22f.zip
Einfache (ziemlich kaputte) Multithreaded IO
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/ClientConnection.cpp6
-rw-r--r--src/Common/ClientConnection.h2
-rw-r--r--src/Common/Connection.cpp6
-rw-r--r--src/Common/Connection.h4
4 files changed, 9 insertions, 9 deletions
diff --git a/src/Common/ClientConnection.cpp b/src/Common/ClientConnection.cpp
index 0e080fd..7b33fb2 100644
--- a/src/Common/ClientConnection.cpp
+++ b/src/Common/ClientConnection.cpp
@@ -20,6 +20,8 @@
#include "ClientConnection.h"
#include <Net/ClientConnection.h>
+#include "Logger.h"
+
namespace Mad {
namespace Common {
@@ -27,8 +29,8 @@ ClientConnection::ClientConnection() : connection(new Net::ClientConnection) {
connection->signalReceive().connect(sigc::mem_fun(this, &ClientConnection::receive));
}
-void ClientConnection::send(const Net::Packet &packet) {
- connection->send(packet);
+bool ClientConnection::send(const Net::Packet &packet) {
+ return connection->send(packet);
}
void ClientConnection::connect(const Net::IPAddress &address, bool daemon) throw(Net::Exception) {
diff --git a/src/Common/ClientConnection.h b/src/Common/ClientConnection.h
index 28a7016..09ca4db 100644
--- a/src/Common/ClientConnection.h
+++ b/src/Common/ClientConnection.h
@@ -37,7 +37,7 @@ class ClientConnection : public Connection {
Net::ClientConnection *connection;
protected:
- virtual void send(const Net::Packet &packet);
+ virtual bool send(const Net::Packet &packet);
public:
ClientConnection();
diff --git a/src/Common/Connection.cpp b/src/Common/Connection.cpp
index cde3fc2..510731f 100644
--- a/src/Common/Connection.cpp
+++ b/src/Common/Connection.cpp
@@ -26,13 +26,11 @@ namespace Mad {
namespace Common {
void Connection::receive(const Net::Packet &packet) {
- // receive() will be called by FdManager (main thread)
- // -> let the ThreadManager call the handler in the worker thread
signal(XmlPacket(packet), packet.getRequestId());
}
-void Connection::sendPacket(const XmlPacket &packet, uint16_t requestId) {
- send(packet.encode(requestId));
+bool Connection::sendPacket(const XmlPacket &packet, uint16_t requestId) {
+ return send(packet.encode(requestId));
}
}
diff --git a/src/Common/Connection.h b/src/Common/Connection.h
index 7bcb92b..860c044 100644
--- a/src/Common/Connection.h
+++ b/src/Common/Connection.h
@@ -50,12 +50,12 @@ class Connection {
void receive(const Net::Packet &packet);
- virtual void send(const Net::Packet &packet) = 0;
+ virtual bool send(const Net::Packet &packet) = 0;
public:
virtual ~Connection() {}
- void sendPacket(const XmlPacket &packet, uint16_t requestId);
+ bool sendPacket(const XmlPacket &packet, uint16_t requestId);
sigc::signal<void, const XmlPacket&, uint16_t> signalReceive() const {
return signal;