private void Handle(AcceptMessage m)
{
if (_isStopped)
return;
if (_initiator.CheckCreateChannel != null)
{
if (_initiator.CheckCreateChannel(m.Socket.RemoteEndPoint, m.Socket) == false)
{
m.Socket.Close();
return;
}
}
if (_initiator.TokenRequired)
{
Context.ActorOf(Props.Create(() => new TokenChecker(_initiator, this, m.Socket)));
}
else
{
var channel = Context.ActorOf(Props.Create(() => new TcpChannel(_initiator, m.Socket, null)));
if (channel == null)
{
_logger?.TraceFormat("Deny a connection. (EndPoint={0})", m.Socket.RemoteEndPoint);
return;
}
_logger?.TraceFormat("Accept a connection. (EndPoint={0})", m.Socket.RemoteEndPoint);
Context.Watch(channel);
_channelSet.Add(channel);
}
}