mirror of https://github.com/deavminet/dnetd.git
Fixed bug whereby newlu created channels were not added to the global channel list
This commit is contained in:
parent
d18e6f4944
commit
bf74c74891
|
@ -31,6 +31,8 @@ public class DChannel
|
|||
{
|
||||
/* Initialize the lock */
|
||||
memberLock = new Mutex();
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public string getName()
|
||||
|
@ -50,9 +52,12 @@ public class DChannel
|
|||
* TODO: Error handling if the calling DConnection fails midway
|
||||
* and doesn't unlock it
|
||||
*/
|
||||
writeln(this);
|
||||
|
||||
/* Add the client */
|
||||
members ~= client;
|
||||
import std.stdio;
|
||||
writeln(members);
|
||||
|
||||
/* Unlock the members list */
|
||||
memberLock.unlock();
|
||||
|
|
|
@ -18,6 +18,7 @@ import core.sync.mutex : Mutex;
|
|||
import dnetd.dserver : DServer;
|
||||
import std.string : split;
|
||||
import dnetd.dchannel : DChannel;
|
||||
import std.conv : to;
|
||||
|
||||
public class DConnection : Thread
|
||||
{
|
||||
|
@ -226,6 +227,8 @@ public class DConnection : Thread
|
|||
{
|
||||
/* TODO: Thread safety for name choice */
|
||||
channel = new DChannel(channelName);
|
||||
|
||||
server.addChannel(this, channel);
|
||||
}
|
||||
|
||||
/* Join the channel */
|
||||
|
@ -370,7 +373,8 @@ public class DConnection : Thread
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
byte[] reply = [false];
|
||||
writeSocket(tag, reply);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -390,4 +394,20 @@ public class DConnection : Thread
|
|||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public override string toString()
|
||||
{
|
||||
string toStr = to!(string)(connType)~"hjhf";
|
||||
|
||||
if(connType == ConnectionType.CLIENT)
|
||||
{
|
||||
toStr = toStr ~ getUsername();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO Implement me */
|
||||
}
|
||||
|
||||
return toStr;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue