Smooth connection and disconnection complete

The clients can connect and disconnect from the server with known no
issues. There is no way to shutdown the server yet, but it might be
possible to kick someone else from the server soon.
This commit is contained in:
Kayne Ruse
2013-06-18 16:21:42 +10:00
parent e833129983
commit 33474cc6c0
14 changed files with 177 additions and 41 deletions
+11 -3
View File
@@ -31,7 +31,7 @@ static int networkQueue(void*) {
return 0;
}
void BeginQueueThread() {
void beginQueueThread() {
if (running) {
return;
}
@@ -41,7 +41,7 @@ void BeginQueueThread() {
}
}
void EndQueueThread() {
void endQueueThread() {
if (!running) {
return;
}
@@ -50,7 +50,7 @@ void EndQueueThread() {
queueThread = nullptr;
}
void KillQueueThread() {
void killQueueThread() {
if (!running) {
return;
}
@@ -78,4 +78,12 @@ Packet popNetworkPacket() {
}
SDL_SemPost(lock);
return p;
}
void flushNetworkQueue() {
UDPNetworkUtility* netUtil = ServiceLocator<UDPNetworkUtility>::Get();
SDL_SemWait(lock);
while(netUtil->Receive());
queue.clear();
SDL_SemPost(lock);
}