+static int
+vconn_stream_recv__(struct vconn_stream *s, int rx_len)
+{
+ struct ofpbuf *rx = s->rxbuf;
+ int want_bytes, retval;
+
+ want_bytes = rx_len - ofpbuf_size(rx);
+ ofpbuf_prealloc_tailroom(rx, want_bytes);
+ retval = stream_recv(s->stream, ofpbuf_tail(rx), want_bytes);
+ if (retval > 0) {
+ ofpbuf_set_size(rx, ofpbuf_size(rx) + retval);
+ return retval == want_bytes ? 0 : EAGAIN;
+ } else if (retval == 0) {
+ if (ofpbuf_size(rx)) {
+ VLOG_ERR_RL(&rl, "connection dropped mid-packet");
+ return EPROTO;
+ }
+ return EOF;
+ } else {
+ return -retval;
+ }
+}
+