PROTON-2301: Further fix to raw connection wake crashes
diff --git a/c/src/proactor/epoll_raw_connection.c b/c/src/proactor/epoll_raw_connection.c
index abbd15e..c10afe8 100644
--- a/c/src/proactor/epoll_raw_connection.c
+++ b/c/src/proactor/epoll_raw_connection.c
@@ -367,7 +367,9 @@
tslot_t *ts = rc->context.runner;
rc->context.working = false;
self_notify = rc->waking && wake(&rc->context);
- wake_pending = rc->waking;
+ // There could be a scheduler wake pending even if we've got no raw connection
+ // wakes outstanding because we dealt with it already in pni_raw_batch_next()
+ wake_pending = rc->context.wake_pending;
unlock(&rc->context.mutex);
if (self_notify) wake_notify(&rc->context);
diff --git a/c/tests/raw_connection_test.cpp b/c/tests/raw_connection_test.cpp
index 04f2cc3..4c0d5bc 100644
--- a/c/tests/raw_connection_test.cpp
+++ b/c/tests/raw_connection_test.cpp
@@ -582,7 +582,7 @@
// Now read other end of socket manually and compare
size_t sz=0;
do {
- long i = rcv(fds[1], rbuffer_memory+sz, BUFFMEMSIZE);
+ long i = rcv(fds[1], rbuffer_memory+sz, BUFFMEMSIZE-sz);
if (i<0) break;
sz+=i;
} while (true);