protected void HandleData(MemBlock b, ISender return_path) {
SecurityDataMessage sdm = new SecurityDataMessage(b);
Dictionary<ISender, PeerSecAssociation> sender_to_sa = null;
PeerSecAssociation sa = null;
try {
sender_to_sa = _spi[sdm.SPI];
sa = sender_to_sa[return_path];
sa.HandleData(b, return_path, null);
} catch(Exception e) {
if(sender_to_sa == null && !SecurityPolicy.Supports(sdm.SPI)) {
ProtocolLog.WriteIf(ProtocolLog.SecurityExceptions, String.Format(
"Unsupported SPI, from {0}, message: {1}", return_path, sdm));
} else {
if(sa == null) {
ProtocolLog.WriteIf(ProtocolLog.SecurityExceptions, String.Format(
"No SA, from {0}, message: {1}", return_path, sdm));
} else if(sa.Closed) {
ProtocolLog.WriteIf(ProtocolLog.SecurityExceptions, String.Format(
"SA, {0}, has been closed, from {1}, message: {2}.", sa,
return_path, sdm));
} else {
ProtocolLog.WriteIf(ProtocolLog.SecurityExceptions, String.Format(
"SA, {0}, from {1}, message: {2}, causes unhandled exception : {3}",
sa, return_path, sdm, e));
}
NoSuchSA(sdm.SPI, return_path);
}
}
}