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...");
|
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 */
|
/* Remove this user from all channels he is in */
|
||||||
DChannel[] channels = server.getChannels();
|
DChannel[] channels = server.getChannels();
|
||||||
|
|
||||||
@ -191,11 +210,8 @@ public class DConnection : Thread
|
|||||||
gprintln(to!(string)(this)~" Leaving '"~currentChannel.getName()~"'...");
|
gprintln(to!(string)(this)~" Leaving '"~currentChannel.getName()~"'...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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 */
|
/* 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);
|
this(server, name, address);
|
||||||
|
|
||||||
/* Save connection */
|
/* Save connection */
|
||||||
|
//this.connection = connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string getName()
|
public string getName()
|
||||||
@ -258,6 +259,9 @@ public final class DMeyer : Thread
|
|||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Every 3 seconds information on what servers are linked will be printed out
|
||||||
|
*/
|
||||||
private void worker()
|
private void worker()
|
||||||
{
|
{
|
||||||
while(true)
|
while(true)
|
||||||
@ -265,6 +269,7 @@ public final class DMeyer : Thread
|
|||||||
linksMutex.lock();
|
linksMutex.lock();
|
||||||
gprintln("Linked servers: "~to!(string)(links), DebugType.WARNING);
|
gprintln("Linked servers: "~to!(string)(links), DebugType.WARNING);
|
||||||
linksMutex.unlock();
|
linksMutex.unlock();
|
||||||
|
|
||||||
Thread.sleep(dur!("seconds")(3));
|
Thread.sleep(dur!("seconds")(3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user