@@ -120,8 +120,13 @@ rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
120
120
while (!accept_connection) {
121
121
122
122
struct kevent event_list[4 ];
123
- int num_events =
124
- kevent (queue_id, events.data (), events.size (), event_list, 4 , NULL );
123
+ int num_events;
124
+ do {
125
+ errno = 0 ;
126
+ num_events =
127
+ kevent (queue_id, events.data (), events.size (), event_list, 4 , NULL );
128
+ } while (num_events == -1 &&
129
+ (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR));
125
130
126
131
if (num_events < 0 ) {
127
132
err.SetError (errno, DNBError::MachKernel);
@@ -291,7 +296,12 @@ rnb_err_t RNBSocket::Read(std::string &p) {
291
296
// DNBLogThreadedIf(LOG_RNB_COMM, "%8u RNBSocket::%s calling read()",
292
297
// (uint32_t)m_timer.ElapsedMicroSeconds(true), __FUNCTION__);
293
298
DNBError err;
294
- ssize_t bytesread = read (m_fd, buf, sizeof (buf));
299
+ ssize_t bytesread;
300
+ do {
301
+ errno = 0 ;
302
+ bytesread = read (m_fd, buf, sizeof (buf));
303
+ } while (bytesread == -1 &&
304
+ (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR));
295
305
if (bytesread <= 0 )
296
306
err.SetError (errno, DNBError::POSIX);
297
307
else
0 commit comments