24 #include <core/exceptions/system.h>
26 #include <netcomm/fawkes/server_client_thread.h>
27 #include <netcomm/fawkes/server_thread.h>
28 #include <netcomm/fawkes/message_queue.h>
29 #include <netcomm/fawkes/transceiver.h>
30 #include <netcomm/socket/stream.h>
31 #include <netcomm/utils/exceptions.h>
32 #include <core/threading/mutex.h>
33 #include <core/threading/wait_condition.h>
61 __outbound_mutex =
new Mutex();
64 __outbound_active = 0;
65 __outbound_msgq = __outbound_msgqs[0];
71 for (
unsigned int i = 0; i < 2; ++i) {
72 while ( ! __outbound_msgqs[i]->empty() ) {
75 __outbound_msgqs[i]->pop();
78 delete __outbound_msgqs[0];
79 delete __outbound_msgqs[1];
80 delete __outbound_mutex;
85 if ( ! __parent->
alive() )
return;
87 while ( __outbound_havemore ) {
88 __outbound_mutex->
lock();
89 __outbound_havemore =
false;
91 __outbound_active = 1 - __outbound_active;
92 __outbound_msgq = __outbound_msgqs[__outbound_active];
93 __outbound_mutex->
unlock();
116 __outbound_mutex->
lock();
117 __outbound_msgq->push(msg);
118 __outbound_havemore =
true;
119 __outbound_mutex->
unlock();
138 Mutex *__outbound_mutex;
139 unsigned int __outbound_active;
140 bool __outbound_havemore;
165 :
Thread(
"FawkesNetworkServerClientThread")
186 delete _inbound_queue;
216 FawkesNetworkServerClientThread::recv()
221 _inbound_queue->
lock();
222 while ( ! _inbound_queue->empty() ) {
227 _inbound_queue->pop();
232 }
catch (ConnectionDiedException &e) {
243 _send_slave->
start();