public DtlsAssociation(ISender sender, CertificateHandler ch, PType ptype,
Ssl ssl, bool client) : base(sender, ch)
{
_ip = new IdentifierPair();
PType = ptype;
_ssl = ssl;
_client = client;
_ssl.SetReadAhead(1);
// Buggy SSL versions have issue with compression and dtls
_ssl.SetOptions((int) SslOptions.SSL_OP_NO_COMPRESSION);
if(client) {
_ssl.SetConnectState();
} else {
_ssl.SetAcceptState();
}
// The ssl object will take control
_read = BIO.MemoryBuffer(false);
_read.NonBlocking = true;
_write = BIO.MemoryBuffer(false);
_write.NonBlocking = true;
_ssl.SetBIO(_read, _write);
_ssl.DoHandshake();
_buffer = new byte[Int16.MaxValue];
_buffer_sync = new object();
_fe_lock = 0;
}