]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
libvirt-stream: Don't require RPC module
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 8 Dec 2021 11:12:27 +0000 (12:12 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 15 Dec 2021 11:12:43 +0000 (12:12 +0100)
When implementing sparse streams, one of improvements I did was
to increase client buffer size for sending/receiving stream data
(commit v1.3.5-rc1~502). Previously, we were using 64KiB buffer
while packets on RPC are 256KiB (usable data is slightly less
because of the header). This meant that it took multiple calls of
virStreamRecv()/virStreamSend() to serve a single packet of data.
In my fix, I've included the virnetprotocol.h file which provides
VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX macro which is the exact size
of data in a single packet. However, including the file from
libvirt-stream.c which implements public APIs is not right. If
RPC module is not built then the file doesn't exists.

Redefine the macro and drop the include. The size can never
change anyways.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/libvirt-stream.c

index bacbbfd325fae974bb96ec38810e5d650d776c00..80dbc83a59b12848da5531fc0073053517902976 100644 (file)
 #include "datatypes.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "rpc/virnetprotocol.h"
 
 VIR_LOG_INIT("libvirt.stream");
 
 #define VIR_FROM_THIS VIR_FROM_STREAMS
 
+/* To avoid dragging in RPC code (which may be not compiled in),
+ * redefine this constant. Its value can't ever change, so we're
+ * safe to do so. */
+#define VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX 262120
+
 
 /**
  * virStreamNew: