Problem: WSS broken under contention

Solution: Make wss_engine_t's read and write consistent with stream_engine_base_t
This commit is contained in:
Yunye Pu 2021-08-31 13:29:41 +08:00
parent bcb659e00e
commit 0e3073f402

View File

@ -194,6 +194,11 @@ int zmq::wss_engine_t::read (void *data_, size_t size_)
return -1; return -1;
} }
if (rc == 0) {
errno = EPIPE;
return -1;
}
if (rc < 0) { if (rc < 0) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
@ -207,14 +212,8 @@ int zmq::wss_engine_t::write (const void *data_, size_t size_)
{ {
ssize_t rc = gnutls_record_send (_tls_session, data_, size_); ssize_t rc = gnutls_record_send (_tls_session, data_, size_);
if (rc == GNUTLS_E_INTERRUPTED) { if (rc == GNUTLS_E_INTERRUPTED || rc == GNUTLS_E_AGAIN) {
errno = EINTR; return 0;
return -1;
}
if (rc == GNUTLS_E_AGAIN) {
errno = EAGAIN;
return -1;
} }
if (rc < 0) { if (rc < 0) {