mirror of
https://github.com/deavminet/dnetd
synced 2024-09-21 17:53:39 +02:00
Refactored
This commit is contained in:
parent
315fcb8ac9
commit
1e3ca829fb
@ -177,6 +177,25 @@ public class DConnection : Thread
|
||||
{
|
||||
gprintln(to!(string)(this)~" Cleaning up connection...");
|
||||
|
||||
/* Leave all channels this connetion was a member of */
|
||||
cleanUp_channels();
|
||||
|
||||
/* Remove this user from the connection queue */
|
||||
server.removeConnection(this);
|
||||
|
||||
gprintln(to!(string)(this)~" Connection cleaned up");
|
||||
}
|
||||
|
||||
/**
|
||||
* Part of the clean up process - `cleanUp()`
|
||||
*
|
||||
* Will leave all channels this connection is
|
||||
* a member of
|
||||
*/
|
||||
private void cleanUp_channels()
|
||||
{
|
||||
gprintln(to!(string)(this)~" Leaving all channels...");
|
||||
|
||||
/* Remove this user from all channels he is in */
|
||||
DChannel[] channels = server.getChannels();
|
||||
|
||||
@ -192,10 +211,7 @@ public class DConnection : Thread
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove this user from the connection queue */
|
||||
server.removeConnection(this);
|
||||
|
||||
gprintln(to!(string)(this)~" Connection cleaned up");
|
||||
gprintln(to!(string)(this)~" Leaving all channels... [done]");
|
||||
}
|
||||
|
||||
/* TODO: add mutex for writing with message and funciton for doing so */
|
||||
|
@ -227,6 +227,7 @@ public final class DLink : Thread
|
||||
this(server, name, address);
|
||||
|
||||
/* Save connection */
|
||||
//this.connection = connection;
|
||||
}
|
||||
|
||||
public string getName()
|
||||
@ -258,6 +259,9 @@ public final class DMeyer : Thread
|
||||
start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Every 3 seconds information on what servers are linked will be printed out
|
||||
*/
|
||||
private void worker()
|
||||
{
|
||||
while(true)
|
||||
@ -265,6 +269,7 @@ public final class DMeyer : Thread
|
||||
linksMutex.lock();
|
||||
gprintln("Linked servers: "~to!(string)(links), DebugType.WARNING);
|
||||
linksMutex.unlock();
|
||||
|
||||
Thread.sleep(dur!("seconds")(3));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user