Browse Source

Fix test rw_blocking

test-assert
Vitaliy Filippov 5 months ago
parent
commit
e544aef7d0
  1. 10
      src/rw_blocking.cpp
  2. 4
      src/stub_osd.cpp

10
src/rw_blocking.cpp

@ -60,7 +60,7 @@ int readv_blocking(int fd, iovec *iov, int iovcnt)
int done = 0;
while (v < iovcnt)
{
ssize_t r = readv(fd, iov, iovcnt);
ssize_t r = readv(fd, iov+v, iovcnt-v);
if (r < 0)
{
if (errno != EAGAIN && errno != EPIPE)
@ -70,6 +70,7 @@ int readv_blocking(int fd, iovec *iov, int iovcnt)
}
continue;
}
done += r;
while (v < iovcnt)
{
if (iov[v].iov_len > r)
@ -80,10 +81,10 @@ int readv_blocking(int fd, iovec *iov, int iovcnt)
}
else
{
r -= iov[v].iov_len;
v++;
}
}
done += r;
}
return done;
}
@ -94,7 +95,7 @@ int writev_blocking(int fd, iovec *iov, int iovcnt)
int done = 0;
while (v < iovcnt)
{
ssize_t r = writev(fd, iov, iovcnt);
ssize_t r = writev(fd, iov+v, iovcnt-v);
if (r < 0)
{
if (errno != EAGAIN && errno != EPIPE)
@ -104,6 +105,7 @@ int writev_blocking(int fd, iovec *iov, int iovcnt)
}
continue;
}
done += r;
while (v < iovcnt)
{
if (iov[v].iov_len > r)
@ -114,10 +116,10 @@ int writev_blocking(int fd, iovec *iov, int iovcnt)
}
else
{
r -= iov[v].iov_len;
v++;
}
}
done += r;
}
return done;
}

4
src/stub_osd.cpp

@ -116,7 +116,7 @@ int bind_stub(const char *bind_address, int bind_port)
void run_stub(int peer_fd)
{
osd_any_op_t op;
osd_any_reply_t reply;
osd_any_reply_t reply = { 0 };
void *buf = NULL;
while (1)
{
@ -139,7 +139,7 @@ void run_stub(int peer_fd)
buf = malloc(op.sec_rw.len);
r = write_blocking(peer_fd, reply.buf, OSD_PACKET_SIZE);
if (r == OSD_PACKET_SIZE)
r = write_blocking(peer_fd, &buf, op.sec_rw.len);
r = write_blocking(peer_fd, buf, op.sec_rw.len);
free(buf);
if (r < op.sec_rw.len)
break;

Loading…
Cancel
Save