Shutdown the client when the refcount hits zero

This commit is contained in:
Tristan B. Velloza Kildaire 2022-01-12 15:57:26 +02:00
parent dde2787bf5
commit 1a9ebb94de
1 changed files with 43 additions and 0 deletions

View File

@ -3,12 +3,55 @@
*/
module libdnet.libdnet;
import std.socket : Address;
public class Client
{
private Address endpoint;
/**
* TODO: We need to re-write Tasky before we can start work on this (urgent)
* TODO: We need to add signal handling to tristanable (not, urgent)
* TODO: We need to check eventy and make sure it is fully completed and
* documented and working (also check if it requires any signal handling, doubt)
*/
this Client(Address endpoint)
{
/* TODO: Initialize stuff here */
this.endpoint = endpoint;
}
/**
* Login
*/
public void login(string[] credentials)
{
}
/**
* Shutsdown the client
*/
public void shutdown()
{
/* TODO: Logout if not already logged out */
/* TODO: Get tasky to shutdown */
}
/* TODO: Hook ~this() onto shutdown() */
/**
* When the next cycle of the garbage collector
* runs and realises there is a zero-refcount
* to this object then shutdown the client
*/
~this()
{
/* Shutdown the client */
shutdown();
}
}