libvirt-stream: Don't require RPC module

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>
This commit is contained in:
Michal Privoznik 2021-12-08 12:12:27 +01:00
parent 0519787f88
commit 81025a6a18

View File

@ -23,12 +23,16 @@
#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: