{
InStream* in= (InStream*) str;
- if (!in->check(1, 1, false)) {
- errno=EAGAIN;
+ try {
+ if (!in->check(1, 1, false)) {
+ gnutls_transport_set_global_errno(EAGAIN);
+ return -1;
+ }
+
+ if (in->getend() - in->getptr() < size)
+ size = in->getend() - in->getptr();
+
+ in->readBytes(data, size);
+
+ } catch (Exception& e) {
+ gnutls_transport_set_global_errno(EINVAL);
return -1;
}
- if (in->getend() - in->getptr() < size)
- size = in->getend() - in->getptr();
-
- in->readBytes(data, size);
-
return size;
}
#include <rdr/Exception.h>
#include <rdr/TLSException.h>
#include <rdr/TLSOutStream.h>
+#include <errno.h>
#ifdef HAVE_GNUTLS
using namespace rdr;
size_t size)
{
OutStream* out = (OutStream*) str;
- out->writeBytes(data, size);
- out->flush();
+
+ try {
+ out->writeBytes(data, size);
+ out->flush();
+ } catch (Exception& e) {
+ gnutls_transport_set_global_errno(EINVAL);
+ return -1;
+ }
+
return size;
}