aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2011-06-30 16:49:08 +0100
committerDaniel P. Berrange <berrange@redhat.com>2011-06-30 18:04:02 +0100
commitcfd4370ad0a0a18363f4f230a1cb8d51ba135119 (patch)
treedcc50d72c8eec40df97e43c441061621ed08598e
parentFix release of virNetMessagePtr instances in streams processing (diff)
downloadlibvirt-cfd4370ad0a0a18363f4f230a1cb8d51ba135119.tar.gz
libvirt-cfd4370ad0a0a18363f4f230a1cb8d51ba135119.tar.bz2
libvirt-cfd4370ad0a0a18363f4f230a1cb8d51ba135119.zip
Send back an error if we get unexpected stream control message
We ignore any stream data packets which come in for streams which are not registered, since these packets are async and do not have a reply. If we get a stream control packet though we must send back an actual error, otherwise a (broken) client may hang forever making it hard to diagnose the client bug. * src/rpc/virnetserverprogram.c: Send back error for unexpected stream control messages
-rw-r--r--src/rpc/virnetserverprogram.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index ca80ae09e..63a6b6dc0 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -257,14 +257,23 @@ int virNetServerProgramDispatch(virNetServerProgramPtr prog,
* stream packets after we closed down a stream. Just drop & ignore
* these.
*/
- VIR_INFO("Ignoring unexpected stream data serial=%d proc=%d status=%d",
- msg->header.serial, msg->header.proc, msg->header.status);
- /* Send a dummy reply to free up 'msg' & unblock client rx */
- memset(msg, 0, sizeof(*msg));
- msg->header.type = VIR_NET_REPLY;
- if (virNetServerClientSendMessage(client, msg) < 0) {
- ret = -1;
- goto cleanup;
+ if (msg->header.status == VIR_NET_CONTINUE) {
+ VIR_INFO("Ignoring unexpected stream data serial=%d proc=%d status=%d",
+ msg->header.serial, msg->header.proc, msg->header.status);
+ /* Send a dummy reply to free up 'msg' & unblock client rx */
+ memset(msg, 0, sizeof(*msg));
+ msg->header.type = VIR_NET_REPLY;
+ if (virNetServerClientSendMessage(client, msg) < 0) {
+ ret = -1;
+ goto cleanup;
+ }
+ } else {
+ VIR_INFO("Unexpected stream control message serial=%d proc=%d status=%d",
+ msg->header.serial, msg->header.proc, msg->header.status);
+ virNetError(VIR_ERR_RPC,
+ _("Unexpected stream control message serial=%d proc=%d status=%d"),
+ msg->header.serial, msg->header.proc, msg->header.status);
+ goto error;
}
ret = 0;
break;