public override void send(byte[] message) { lock (this) { Association a = base.getAssociation(); SCTPMessage m = a.makeMessage(message, this); undeliveredOutboundMessages.Add(m.getSeq(), m); a.sendAndBlock(m); } }
public override async Task sendasync(byte[] message) { await semaphore.WaitAsync().ConfigureAwait(false); try { Association a = base.getAssociation(); SCTPMessage m = a.makeMessage(message, this); if (m == null) { logger.LogError("SCTPMessage cannot be null, but it is"); return; } undeliveredOutboundMessages.AddOrUpdate(m.getSeq(), m, (id, b) => m); a.sendAndBlock(m); } finally { semaphore.Release(); } }