- Refactored packaging

- Removed now-completed TODO
This commit is contained in:
Tristan B. Velloza Kildaire 2023-09-25 15:18:57 +02:00
parent 42471e21d1
commit c438c6c78c
4 changed files with 14 additions and 14 deletions

View File

@ -1,8 +1,7 @@
module doap.client.client;
import std.socket : Socket, Address, SocketType, ProtocolType, getAddress, parseAddress, InternetAddress, SocketShutdown;
import doap.client.messaging : CoapMessagingLayer;
import doap.client.mesglayer : CoapMessagingLayerFR;
import doap.client.messaging;
import doap.protocol;
import doap.client.request : CoapRequestBuilder, CoapRequest, CoapRequestFuture;
import core.sync.mutex : Mutex;
@ -29,7 +28,7 @@ public class CoapClient
* The messaging layer which provides
* request-response message match-ups
*/
private CoapMessagingLayerFR messaging;
private CoapMessagingLayer messaging;
/**
* The request-response match list
@ -56,7 +55,9 @@ public class CoapClient
this(Address address)
{
this.address = address;
this.messaging = new CoapMessagingLayer(this); //UDP transport
import doap.client.messaging.udp : UDPMessaging;
this.messaging = new UDPMessaging(this); //UDP transport
this.requestsLock = new Mutex();
this.watcherSignal = new Condition(this.requestsLock);

View File

@ -1,10 +1,10 @@
module doap.client.mesglayer;
module doap.client.messaging.core;
import doap.client.client : CoapClient;
import std.socket : Address;
import doap.protocol.packet : CoapPacket;
public abstract class CoapMessagingLayerFR
public abstract class CoapMessagingLayer
{
/**
* The client

View File

@ -0,0 +1,3 @@
module doap.client.messaging;
public import doap.client.messaging.core : CoapMessagingLayer;

View File

@ -1,4 +1,4 @@
module doap.client.messaging;
module doap.client.messaging.udp;
import doap.client.client : CoapClient;
import core.thread : Thread;
@ -15,19 +15,15 @@ import std.socket : Address;
import std.socket : Socket, Address, SocketType, ProtocolType, getAddress, parseAddress, InternetAddress, SocketShutdown;
import doap.client.mesglayer : CoapMessagingLayerFR;
// TODO: Generalize this and then make
// ... a UDP version of it
import doap.client.messaging;
/**
* Stateful management of responses for
* previously made requests.
* UDP-based messaging layer
*
* Handles the actual sending and receiving
* of datagrams and fulfilling of requests
*/
public class CoapMessagingLayer : CoapMessagingLayerFR
public class UDPMessaging : CoapMessagingLayer
{
/**
* Reading-loop thread