aboutsummaryrefslogtreecommitdiff
path: root/src/platform/windows/win_tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/windows/win_tcp.c')
-rw-r--r--src/platform/windows/win_tcp.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/platform/windows/win_tcp.c b/src/platform/windows/win_tcp.c
index 5e27d4ee..375a72c3 100644
--- a/src/platform/windows/win_tcp.c
+++ b/src/platform/windows/win_tcp.c
@@ -171,7 +171,7 @@ nni_win_tcp_pipe_finish(nni_win_event *evt, nni_aio *aio)
aio->a_count += cnt;
while (cnt > 0) {
- // If we didn't write the first full iov,
+ // If we didn't transfer the first full iov,
// then we're done for now. Record progress
// and move on.
if (cnt < aio->a_iov[0].iov_len) {
@@ -182,7 +182,7 @@ nni_win_tcp_pipe_finish(nni_win_event *evt, nni_aio *aio)
}
// We consumed the full iov, so just move the
- // remaininng ones up, and decrement count handled.
+ // remaining ones up, and decrement count handled.
cnt -= aio->a_iov[0].iov_len;
for (i = 1; i < aio->a_niov; i++) {
aio->a_iov[i - 1] = aio->a_iov[i];
@@ -191,10 +191,15 @@ nni_win_tcp_pipe_finish(nni_win_event *evt, nni_aio *aio)
aio->a_niov--;
}
- if (aio->a_niov > 0) {
+ while (aio->a_niov > 0) {
// If we have more to do, submit it!
- nni_win_event_resubmit(evt, aio);
- return;
+ if (aio->a_iov[0].iov_len > 0) {
+ nni_win_event_resubmit(evt, aio);
+ return;
+ }
+ for (i = 1; i < aio->a_niov; i++) {
+ aio->a_iov[i - 1] = aio->a_iov[i];
+ }
}
}