private bool onHeaderRead(Connection conn, byte[] data, int size, bool success)
{
if (conn != this)
{
throw new Exception("THAT EVENT IS NOT FOR MEEE!");
}
if (!success)
{
return(false);
}
string error_msg = "";
if (!header.Parse(data, (int)size, ref error_msg))
{
drop(DropReason.HeaderError);
return(false);
}
else
{
string error_val = "";
if (header.Values.Contains("error"))
{
error_val = (string)header.Values["error"];
EDB.WriteLine("Received error message in header for connection to [{0}]: [{1}]",
"TCPROS connection to [" + transport.cached_remote_host + "]", error_val);
drop(DropReason.HeaderError);
return(false);
}
else
{
if (header_func == null)
{
throw new Exception("AMG YOUR HEADERFUNC SUCKS");
}
transport.parseHeader(header);
header_func(conn, header);
}
}
return(true);
}