mirror of
https://github.com/deavmi/birchwood
synced 2024-09-20 11:43:22 +02:00
Sender
- When `wait()` has an `InterruptedException` then go back to the loop again (retry the `wait()`) - On `SnoozeError` (for now) we also do the same even though we should stop the loop Receiver - When `wait()` has an `InterruptedException` then go back to the loop again (retry the `wait()`) - On `SnoozeError` (for now) we also do the same even though we should stop the loop Dub - Upgraded to `libsnooze` version `1.0.0-beta`
This commit is contained in:
parent
68a8fc74ae
commit
f6069ed254
2
dub.json
2
dub.json
@ -7,7 +7,7 @@
|
||||
"dependencies": {
|
||||
"dlog": "0.3.19",
|
||||
"eventy": "0.4.0",
|
||||
"libsnooze": "0.3.3"
|
||||
"libsnooze": "1.0.0-beta"
|
||||
},
|
||||
"description": "A sane IRC framework for the D language",
|
||||
"license": "LGPL-3.0",
|
||||
|
@ -20,6 +20,11 @@ import std.string : indexOf;
|
||||
import birchwood.client.events : PongEvent, IRCEvent;
|
||||
import std.string : cmp;
|
||||
|
||||
version(unittest)
|
||||
{
|
||||
import std.stdio : writeln;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages the receive queue and performs
|
||||
* message parsing and event triggering
|
||||
@ -126,9 +131,28 @@ public final class ReceiverThread : Thread
|
||||
|
||||
// TODO: See above notes about libsnooze behaviour due
|
||||
// ... to usage in our context
|
||||
try
|
||||
{
|
||||
receiveEvent.wait();
|
||||
}
|
||||
catch(InterruptedException e)
|
||||
{
|
||||
version(unittest)
|
||||
{
|
||||
writeln("wait() interrupted");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
catch(SnoozeError e)
|
||||
{
|
||||
// TODO: This should crash and end
|
||||
version(unittest)
|
||||
{
|
||||
writeln("wait() had an error");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Catch InterruptedException here
|
||||
receiveEvent.wait(); // TODO: Catch any exceptions from libsnooze
|
||||
|
||||
|
||||
|
||||
|
@ -14,6 +14,11 @@ import libsnooze;
|
||||
|
||||
import birchwood.client;
|
||||
|
||||
version(unittest)
|
||||
{
|
||||
import std.stdio : writeln;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages the send queue
|
||||
*/
|
||||
@ -116,9 +121,30 @@ public final class SenderThread : Thread
|
||||
|
||||
// TODO: See above notes about libsnooze behaviour due
|
||||
// ... to usage in our context
|
||||
try
|
||||
{
|
||||
sendEvent.wait();
|
||||
}
|
||||
catch(InterruptedException e)
|
||||
{
|
||||
version(unittest)
|
||||
{
|
||||
writeln("wait() interrupted");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
catch(SnoozeError e)
|
||||
{
|
||||
// TODO: This should crash and end
|
||||
version(unittest)
|
||||
{
|
||||
writeln("wait() had an error");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO: Catch InterruptedException here
|
||||
sendEvent.wait(); // TODO: Catch any exceptions from libsnooze
|
||||
|
||||
// TODO: After the above call have a once-off call to `ensure()` here
|
||||
// ... which then only runs once and sets a `ready` flag for the Client
|
||||
|
Loading…
Reference in New Issue
Block a user