d1->buffered_messages = pqueue_new();
d1->sent_messages = pqueue_new();
- d1->buffered_app_data.q = pqueue_new();
if (s->server) {
d1->cookie_len = sizeof(s->d1->cookie);
d1->link_mtu = 0;
d1->mtu = 0;
- if (!d1->buffered_messages || !d1->sent_messages
- || !d1->buffered_app_data.q) {
+ if (!d1->buffered_messages || !d1->sent_messages) {
if (d1->buffered_messages)
pqueue_free(d1->buffered_messages);
if (d1->sent_messages)
pqueue_free(d1->sent_messages);
- if (d1->buffered_app_data.q)
- pqueue_free(d1->buffered_app_data.q);
OPENSSL_free(d1);
ssl3_free(s);
return (0);
{
pitem *item = NULL;
hm_fragment *frag = NULL;
- DTLS1_RECORD_DATA *rdata;
while ((item = pqueue_pop(s->d1->buffered_messages)) != NULL) {
frag = (hm_fragment *)item->data;
dtls1_hm_fragment_free(frag);
pitem_free(item);
}
-
- while ((item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL) {
- rdata = (DTLS1_RECORD_DATA *)item->data;
- if (rdata->rbuf.buf) {
- OPENSSL_free(rdata->rbuf.buf);
- }
- OPENSSL_free(item->data);
- pitem_free(item);
- }
}
void dtls1_free(SSL *s)
pqueue_free(s->d1->buffered_messages);
pqueue_free(s->d1->sent_messages);
- pqueue_free(s->d1->buffered_app_data.q);
OPENSSL_free(s->d1);
s->d1 = NULL;
{
pqueue buffered_messages;
pqueue sent_messages;
- pqueue buffered_app_data;
unsigned int mtu;
unsigned int link_mtu;
if (s->d1) {
buffered_messages = s->d1->buffered_messages;
sent_messages = s->d1->sent_messages;
- buffered_app_data = s->d1->buffered_app_data.q;
mtu = s->d1->mtu;
link_mtu = s->d1->link_mtu;
s->d1->buffered_messages = buffered_messages;
s->d1->sent_messages = sent_messages;
- s->d1->buffered_app_data.q = buffered_app_data;
}
ssl3_clear(s);
d->unprocessed_rcds.q = pqueue_new();
d->processed_rcds.q = pqueue_new();
+ d->buffered_app_data.q = pqueue_new();
- if (!d->unprocessed_rcds.q || !d->processed_rcds.q) {
+ if (!d->unprocessed_rcds.q || !d->processed_rcds.q
+ || !d->buffered_app_data.q) {
if (d->unprocessed_rcds.q)
pqueue_free(d->unprocessed_rcds.q);
if (d->processed_rcds.q)
pqueue_free(d->processed_rcds.q);
+ if (d->buffered_app_data.q)
+ pqueue_free(d->buffered_app_data.q);
OPENSSL_free(d);
rl->d = NULL;
return (0);
DTLS_RECORD_LAYER_clear(rl);
pqueue_free(rl->d->unprocessed_rcds.q);
pqueue_free(rl->d->processed_rcds.q);
+ pqueue_free(rl->d->buffered_app_data.q);
OPENSSL_free(rl->d);
rl->d = NULL;
}
DTLS1_RECORD_DATA *rdata;
pqueue unprocessed_rcds;
pqueue processed_rcds;
+ pqueue buffered_app_data;
d = rl->d;
pitem_free(item);
}
+ while ((item = pqueue_pop(d->buffered_app_data.q)) != NULL) {
+ rdata = (DTLS1_RECORD_DATA *)item->data;
+ if (rdata->rbuf.buf) {
+ OPENSSL_free(rdata->rbuf.buf);
+ }
+ OPENSSL_free(item->data);
+ pitem_free(item);
+ }
+
unprocessed_rcds = d->unprocessed_rcds.q;
processed_rcds = d->processed_rcds.q;
+ buffered_app_data = d->buffered_app_data.q;
memset(d, 0, sizeof *d);
d->unprocessed_rcds.q = unprocessed_rcds;
d->processed_rcds.q = processed_rcds;
+ d->buffered_app_data.q = buffered_app_data;
}
static int have_handshake_fragment(SSL *s, int type, unsigned char *buf,
*/
if (s->state == SSL_ST_OK && rr->length == 0) {
pitem *item;
- item = pqueue_pop(s->d1->buffered_app_data.q);
+ item = pqueue_pop(s->rlayer.d->buffered_app_data.q);
if (item) {
#ifndef OPENSSL_NO_SCTP
/* Restore bio_dgram_sctp_rcvinfo struct */
* the packets were reordered on their way, so buffer the application
* data for later processing rather than dropping the connection.
*/
- if (dtls1_buffer_record(s, &(s->d1->buffered_app_data), rr->seq_num) <
- 0) {
+ if (dtls1_buffer_record(s, &(s->rlayer.d->buffered_app_data),
+ rr->seq_num) < 0) {
SSLerr(SSL_F_DTLS1_READ_BYTES, ERR_R_INTERNAL_ERROR);
return -1;
}
/* Received handshake records (processed and unprocessed) */
record_pqueue unprocessed_rcds;
record_pqueue processed_rcds;
-
+ /*
+ * Buffered application records. Only for records between CCS and
+ * Finished to prevent either protocol violation or unnecessary message
+ * loss.
+ */
+ record_pqueue buffered_app_data;
/*
* storage for Alert/Handshake protocol data received but not yet
* processed by ssl3_read_bytes:
pqueue buffered_messages;
/* Buffered (sent) handshake records */
pqueue sent_messages;
- /*
- * Buffered application records. Only for records between CCS and
- * Finished to prevent either protocol violation or unnecessary message
- * loss.
- */
- record_pqueue buffered_app_data;
+
/* Is set when listening for new connections with dtls1_listen() */
unsigned int listen;
unsigned int link_mtu; /* max on-the-wire DTLS packet size */