mirror of
https://github.com/deavmi/birchwood
synced 2024-09-20 11:43:22 +02:00
Client
- Now catches `SnoozeError` if a the libsnooze `Event`'s failed to have their `ensure()` call succeed ErrorType - Updated description for enum member `INTERNAL_FAILURE` Sender - Removed now-completed TODO Receiver - Removed now-completed TODO
This commit is contained in:
parent
fe9bf31ad5
commit
b79a3ad8ee
@ -19,6 +19,8 @@ import birchwood.client.receiver : ReceiverThread;
|
|||||||
import birchwood.client.sender : SenderThread;
|
import birchwood.client.sender : SenderThread;
|
||||||
import birchwood.client.events;
|
import birchwood.client.events;
|
||||||
|
|
||||||
|
import libsnooze.exceptions : SnoozeError;
|
||||||
|
|
||||||
import dlog;
|
import dlog;
|
||||||
|
|
||||||
package __gshared Logger logger;
|
package __gshared Logger logger;
|
||||||
@ -819,6 +821,10 @@ public class Client : Thread
|
|||||||
{
|
{
|
||||||
throw new BirchwoodException(ErrorType.INTERNAL_FAILURE, e.toString());
|
throw new BirchwoodException(ErrorType.INTERNAL_FAILURE, e.toString());
|
||||||
}
|
}
|
||||||
|
catch(SnoozeError e)
|
||||||
|
{
|
||||||
|
throw new BirchwoodException(ErrorType.INTERNAL_FAILURE, e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO: Do actual liveliness check here
|
// TODO: Do actual liveliness check here
|
||||||
else
|
else
|
||||||
|
@ -18,7 +18,10 @@ public enum ErrorType
|
|||||||
/**
|
/**
|
||||||
* This could occur from errors with `Eventy`
|
* This could occur from errors with `Eventy`
|
||||||
* when setting up the signal handlers and
|
* when setting up the signal handlers and
|
||||||
* event types
|
* event types. It can also occur if `libsnooze`
|
||||||
|
* has an error which would occur when calling
|
||||||
|
* `ensure(Thread)` for the `Receiver` and `Sender`
|
||||||
|
* threads
|
||||||
*/
|
*/
|
||||||
INTERNAL_FAILURE,
|
INTERNAL_FAILURE,
|
||||||
|
|
||||||
|
@ -60,12 +60,15 @@ public final class ReceiverThread : Thread
|
|||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* client = the Client to associate with
|
* client = the Client to associate with
|
||||||
|
* Throws:
|
||||||
|
* `SnoozeError` on failure to construct an
|
||||||
|
* `Event` or ensure ourselves
|
||||||
*/
|
*/
|
||||||
this(Client client)
|
this(Client client)
|
||||||
{
|
{
|
||||||
super(&recvHandlerFunc);
|
super(&recvHandlerFunc);
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.receiveEvent = new Event(); // TODO: Catch any libsnooze error here
|
this.receiveEvent = new Event();
|
||||||
this.recvQueueLock = new Mutex();
|
this.recvQueueLock = new Mutex();
|
||||||
this.receiveEvent.ensure(this);
|
this.receiveEvent.ensure(this);
|
||||||
}
|
}
|
||||||
|
@ -52,12 +52,15 @@ public final class SenderThread : Thread
|
|||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* client = the Client to associate with
|
* client = the Client to associate with
|
||||||
|
* Throws:
|
||||||
|
* `SnoozeError` on failure to construct an
|
||||||
|
* `Event` or ensure ourselves
|
||||||
*/
|
*/
|
||||||
this(Client client)
|
this(Client client)
|
||||||
{
|
{
|
||||||
super(&sendHandlerFunc);
|
super(&sendHandlerFunc);
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.sendEvent = new Event(); // TODO: Catch any libsnooze error here
|
this.sendEvent = new Event();
|
||||||
this.sendQueueLock = new Mutex();
|
this.sendQueueLock = new Mutex();
|
||||||
this.sendEvent.ensure(this);
|
this.sendEvent.ensure(this);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user