* Bytes cosnumed in cache
*/
size_t cache_done;
+
+ /**
+ * Close TLS connection?
+ */
+ bool close;
};
/**
chunk_t data;
size_t len;
+ if (this->close)
+ {
+ return SUCCESS;
+ }
len = min(reader->remaining(reader), this->in.len - this->in_done);
if (len)
{ /* copy to read buffer as much as fits in */
METHOD(tls_application_t, build, status_t,
private_tls_application_t *this, bio_writer_t *writer)
{
+ if (this->close)
+ {
+ return SUCCESS;
+ }
if (this->out.len > this->out_done)
{
writer->write_data(writer, this->out);
continue;
case INVALID_STATE:
break;
+ case SUCCESS:
+ return TRUE;
default:
return FALSE;
}
{ /* EOF */
return TRUE;
}
- if (this->tls->process(this->tls, buf, len) != NEED_MORE)
+ switch (this->tls->process(this->tls, buf, len))
{
- return FALSE;
+ case NEED_MORE:
+ break;
+ case SUCCESS:
+ return TRUE;
+ default:
+ return FALSE;
}
}
}
METHOD(tls_socket_t, destroy, void,
private_tls_socket_t *this)
{
+ /* send a TLS close notify if not done yet */
+ this->app.close = TRUE;
+ write_(this, NULL, 0);
free(this->app.cache.ptr);
this->tls->destroy(this->tls);
free(this);