protected internal virtual int recvChallenge()
{
int challenge;
try
{
byte[] buf = read2BytePackage();
OtpInputStream ibuf = new OtpInputStream(buf);
peer.ntype = ibuf.read1();
if (peer.ntype != AbstractNode.NTYPE_R6)
{
throw new System.IO.IOException("Unexpected peer type");
}
peer._distLow = (peer._distHigh = ibuf.read2BE());
peer.flags = ibuf.read4BE();
challenge = ibuf.read4BE();
byte[] tmpname = new byte[buf.Length - 11];
ibuf.readN(tmpname);
char[] tmpChar;
tmpChar = new char[tmpname.Length];
tmpname.CopyTo(tmpChar, 0);
System.String hisname = new System.String(tmpChar);
int i = hisname.IndexOf((System.Char) '@', 0);
peer._node = hisname;
peer._alive = hisname.Substring(0, (i) - (0));
peer._host = hisname.Substring(i + 1, (hisname.Length) - (i + 1));
}
catch (Erlang.Exception)
{
throw new System.IO.IOException("Handshake failed - not enough data");
}
if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
OtpTrace.TraceEvent("<- " + "HANDSHAKE recvChallenge" + " from=" + peer._node + " challenge=" + challenge + " local=" + self);
}
return challenge;
}