[Spice-devel] [PATCH spice-streaming-agent 1/6] Be more restrictive about error handling
Frediano Ziglio
fziglio at redhat.com
Mon Feb 19 16:45:35 UTC 2018
>
> On Mon, 2018-02-19 at 15:52 +0000, Frediano Ziglio wrote:
> > There's no much point in ignoring the error if these errors cause the
> > communication to be out of sync.
> > Ignoring them just change the state to indetermidate.
> >
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> > src/spice-streaming-agent.cpp | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> > index 45a92b9..1f41a6f 100644
> > --- a/src/spice-streaming-agent.cpp
> > +++ b/src/spice-streaming-agent.cpp
> > @@ -94,17 +94,17 @@ static int read_command_from_device(void)
> > if (hdr.protocol_version != STREAM_DEVICE_PROTOCOL) {
> > syslog(LOG_WARNING, "BAD VERSION %d (expected is %d)\n",
> > hdr.protocol_version,
> > STREAM_DEVICE_PROTOCOL);
> > - return 0; // return -1; -- fail over this ?
> > + return -1;
> > }
> > if (hdr.type != STREAM_TYPE_START_STOP) {
> > syslog(LOG_WARNING, "UNKNOWN msg of type %d\n", hdr.type);
> > - return 0; // return -1;
> > + return -1;
> > }
> > if (hdr.size >= sizeof(msg)) {
> > syslog(LOG_WARNING,
> > "msg size (%d) is too long (longer than %lu)\n",
> > hdr.size, sizeof(msg));
> > - return 0; // return -1;
> > + return -1;
> > }
> > n = read(streamfd, &msg, hdr.size);
> > if (n != hdr.size) {
>
> Hi, why not, but why not skip this and use the exceptions straight
> away?
>
> Lukas
>
Seems more incremental that way.
Frediano
More information about the Spice-devel
mailing list