Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken connection handling #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions source/renaissance/connection/connection.d
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ public class Connection : Thread

// TODO: Well, we'd tasky I guess so I'd need to use it there I guess

// TODO: Imp,ent nthe loop condition status (exit on error)
bool isGood = true;
while(isGood)
queue_loop: while(true)
{
// TODO: Addn a tasky/tristanable queue managing thing with
// ... socket here (probably just the latter)
Expand All @@ -113,9 +111,20 @@ public class Connection : Thread
// ... (this would make sense as this woul dbe something)
// ... we didn't test for

// Dequeue a message from the incoming queue
TaggedMessage incomingMessage = incomingQueue.dequeue();


TaggedMessage incomingMessage;

try
{
// Dequeue a message from the incoming queue
incomingMessage = incomingQueue.dequeue();
}
catch(TristanableException e)
{
logger.error("We had a fatal tristanable exception whilst dequeue()'ing: "~e.toString());
break queue_loop;
}

logger.dbg("Awoken? after dequeue()");

// Process the message
Expand All @@ -131,11 +140,20 @@ public class Connection : Thread
}
}

// Clean up (TODO: Shutdown the TManager)

// Clean up - shutdown the tristanable manager
logger.dbg("Stopping tristanable manager...");
this.tManager.stop();
logger.dbg("Stopping tristanable manager... [done]");

// Clean up - shutdown the socket (close it)
logger.dbg("Shutting down river stream...");
clientStream.close();
logger.dbg("Shutting down river stream... [done]");

// Clean up - notify disconnection
logger.dbg("Notifying the server of connection disconnect...");
this.associatedServer.onConnectionDisconnect(this);
logger.dbg("Notifying the server of connection disconnect... [done]");
}

// FIXME: These should be part of the auth details
Expand Down
Loading