Compare commits

...

5 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire 24aaf05dd5 README
- Added coverage badge
2023-11-26 14:17:56 +02:00
Tristan B. Velloza Kildaire 313ff9b557 Connection
- Removed now-completed TODO
- Use a boolean to supress unreachable errors
- Added a TODO to implement the above
- On exiting loop call the `Server`'s `onConnectionDisconnect(Connection)` method
2023-11-26 14:15:59 +02:00
Tristan B. Velloza Kildaire 416d583658 Connection
- Added TODO (backported)
2023-11-26 14:13:12 +02:00
Tristan B. Velloza Kildaire d44cc03437 Server
- Added initial implementation of `onConnectionDisconnect(Connection connection)`
2023-11-26 14:12:04 +02:00
Tristan B. Velloza Kildaire bbcf9b1413 LinkType
- Added first member (so `LinkType.init`) `UNSET`

Connection

- Added `linkType` and getter
2023-11-26 14:09:25 +02:00
3 changed files with 47 additions and 3 deletions

View File

@ -13,4 +13,4 @@
<br>
<br>
[![D](https://github.com/renaissanceorg/renaissance/actions/workflows/d.yml/badge.svg)](https://github.com/renaissanceorg/renaissance/actions/workflows/d.yml)
[![D](https://github.com/renaissanceorg/renaissance/actions/workflows/d.yml/badge.svg)](https://github.com/renaissanceorg/renaissance/actions/workflows/d.yml) [![Coverage Status](https://coveralls.io/repos/github/renaissanceorg/renaissance/badge.svg?branch=feature/queueing)](https://coveralls.io/github/renaissanceorg/renaissance?branch=feature/queueing)

View File

@ -22,6 +22,7 @@ import std.conv : to;
public enum LinkType
{
UNSET,
USER,
SERVER
}
@ -43,6 +44,12 @@ public class Connection : Thread
private Manager tManager;
private Queue incomingQueue;
/**
* Whether this is a user connection
* or a server link
*/
private LinkType linkType;
private this(Server associatedServer, Stream clientStream)
{
this.associatedServer = associatedServer;
@ -72,6 +79,11 @@ public class Connection : Thread
this.tManager.setDefaultQueue(this.incomingQueue);
}
public LinkType getLinkType()
{
return this.linkType;
}
private void worker()
{
// TODO: Start tristanable manager here
@ -84,8 +96,9 @@ public class Connection : Thread
// TODO: Well, we'd tasky I guess so I'd need to use it there I guess
// TODO: Add worker function here
while(true)
// TODO: Imp,ent nthe loop condition status (exit on error)
bool isGood = true;
while(isGood)
{
// TODO: Addn a tasky/tristanable queue managing thing with
// ... socket here (probably just the latter)
@ -117,6 +130,12 @@ public class Connection : Thread
logger.dbg("There was no response, not sending anything.");
}
}
// Clean up (TODO: Shutdown the TManager)
// Clean up - notify disconnection
this.associatedServer.onConnectionDisconnect(this);
}
// FIXME: These should be part of the auth details

View File

@ -265,6 +265,31 @@ public class Server : MessageDeliveryTransport
return true;
}
// On connection disconnecting
public void onConnectionDisconnect(Connection connection)
{
// TODO: Decide whether it is a user link or a server de-link
import renaissance.connection.connection : LinkType;
LinkType type = connection.getLinkType();
logger.dbg("Disconnecting link ", connection, " of type ", type);
switch(type)
{
case LinkType.UNSET:
logger.warn("Not doing anything because this link's type was never set");
break;
case LinkType.USER:
// TODO: Implement me
break;
case LinkType.SERVER:
// TODO: Implement me
break;
default:
break;
}
}
}
version(unittest)