public Session CreateSession(byte[] cookieValue)
{
var temp = cookieValue.BytesToString();
if (!_cookies.ContainsKey(temp))
{
Logger.WARN("Creating session for an unknown cookie '{0}' (CPU congestion?)",temp);
return null;
}
var cookie = _cookies[temp];
Peer.Id = (byte[]) cookie.PeerId.Clone();
RtmfpUtils.UnpackUrl(cookie.QueryUrl,out Peer.Path,out Peer.Properties);
FarId = cookie.FarId;
Peer.Address = cookie.PeerAddress;
var session = Handler.CreateSession(Peer, cookie);
cookie.Id = session.Id;
cookie.Write();
if(cookie.Target != null)
{
//cookie.Target.InitiatorNonce = cookie.CookieComputing.InitiatorNonce.Clone() as byte[];
cookie.Target.SharedSecret = cookie.CookieComputing.SharedSecret;
}
Writer.Write((byte)0x78);
Writer.Write(cookie.Length);
cookie.Read(Writer.BaseStream);
Flush(0x0b);
FarId = 0;
return session;
}