summaryrefslogtreecommitdiffstats
path: root/src/Net/Connection.h
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-06-27 19:54:43 +0200
committerMatthias Schiffer <matthias@gamezock.de>2008-06-27 19:54:43 +0200
commitc0bd49f419b0850085d651a4ceeca45cf9d09832 (patch)
treeec845a5805a6fb82ad7f6d9ed13a106b3109cdc8 /src/Net/Connection.h
parentd1306a1710cda4acb9a0138347cdb43943271b9c (diff)
downloadmad-c0bd49f419b0850085d651a4ceeca45cf9d09832.tar
mad-c0bd49f419b0850085d651a4ceeca45cf9d09832.zip
Behandle GnuTLS-Bye korrekt
Diffstat (limited to 'src/Net/Connection.h')
-rw-r--r--src/Net/Connection.h32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/Net/Connection.h b/src/Net/Connection.h
index a3670b0..01926e1 100644
--- a/src/Net/Connection.h
+++ b/src/Net/Connection.h
@@ -62,12 +62,23 @@ class Connection {
void doReceive();
void doSend();
+ void doBye();
+
void doDisconnect();
bool receiveComplete() const {
return (transR.length == transR.transmitted);
}
+ void bye() {
+ if(state != DISCONNECT)
+ return;
+
+ state = BYE;
+
+ doBye();
+ }
+
// Prevent shallow copy
Connection(const Connection &o);
Connection& operator=(const Connection &o);
@@ -162,26 +173,7 @@ class Connection {
return rawSend(reinterpret_cast<const unsigned char*>(packet.getRawData()), packet.getRawDataLength());
}
- void sendReceive(short events = POLLIN|POLLOUT) {
- if(events & POLLHUP || events & POLLERR) {
- doDisconnect();
- return;
- }
-
- if(state == HANDSHAKE) {
- doHandshake();
- return;
- }
-
- if(events & POLLIN)
- doReceive();
-
- if(events & POLLOUT)
- doSend();
-
- if(state == DISCONNECT && sendQueueEmpty())
- doDisconnect();
- }
+ void sendReceive(short events = POLLIN|POLLOUT);
bool sendQueueEmpty() const {return transS.empty();}