|
|
a547b4 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
a547b4 |
From: Christophe Fergeau <cfergeau@redhat.com>
|
|
|
a547b4 |
Date: Tue, 8 Apr 2014 16:11:38 +0200
|
|
|
a547b4 |
Subject: [PATCH] Report an error when file transfers are disabled
|
|
|
a547b4 |
|
|
|
a547b4 |
This commit sends back a VD_AGENT_FILE_XFER_STATUS_ERROR to clients which
|
|
|
a547b4 |
try to transfer files when the agent disabled file transfers (for example
|
|
|
a547b4 |
because there is no valid destination directory for the transferred files).
|
|
|
a547b4 |
|
|
|
a547b4 |
(cherry picked from commit 9ea18740b8cf4466ebd2f6bca42d1d70dd0ba01c)
|
|
|
a547b4 |
---
|
|
|
a547b4 |
src/vdagent-file-xfers.c | 8 ++++++++
|
|
|
a547b4 |
src/vdagent-file-xfers.h | 2 ++
|
|
|
a547b4 |
src/vdagent.c | 9 +++++++++
|
|
|
a547b4 |
3 files changed, 19 insertions(+)
|
|
|
a547b4 |
|
|
|
a547b4 |
diff --git a/src/vdagent-file-xfers.c b/src/vdagent-file-xfers.c
|
|
|
a547b4 |
index d59910b..0dc549b 100644
|
|
|
a547b4 |
--- a/src/vdagent-file-xfers.c
|
|
|
a547b4 |
+++ b/src/vdagent-file-xfers.c
|
|
|
a547b4 |
@@ -316,3 +316,11 @@ void vdagent_file_xfers_data(struct vdagent_file_xfers *xfers,
|
|
|
a547b4 |
g_hash_table_remove(xfers->xfers, GUINT_TO_POINTER(msg->id));
|
|
|
a547b4 |
}
|
|
|
a547b4 |
}
|
|
|
a547b4 |
+
|
|
|
a547b4 |
+void vdagent_file_xfers_error(struct udscs_connection *vdagentd, uint32_t msg_id)
|
|
|
a547b4 |
+{
|
|
|
a547b4 |
+ g_return_if_fail(vdagentd != NULL);
|
|
|
a547b4 |
+
|
|
|
a547b4 |
+ udscs_write(vdagentd, VDAGENTD_FILE_XFER_STATUS,
|
|
|
a547b4 |
+ msg_id, VD_AGENT_FILE_XFER_STATUS_ERROR, NULL, 0);
|
|
|
a547b4 |
+}
|
|
|
a547b4 |
diff --git a/src/vdagent-file-xfers.h b/src/vdagent-file-xfers.h
|
|
|
a547b4 |
index 20783eb..fe5da81 100644
|
|
|
a547b4 |
--- a/src/vdagent-file-xfers.h
|
|
|
a547b4 |
+++ b/src/vdagent-file-xfers.h
|
|
|
a547b4 |
@@ -37,5 +37,7 @@ void vdagent_file_xfers_status(struct vdagent_file_xfers *xfers,
|
|
|
a547b4 |
VDAgentFileXferStatusMessage *msg);
|
|
|
a547b4 |
void vdagent_file_xfers_data(struct vdagent_file_xfers *xfers,
|
|
|
a547b4 |
VDAgentFileXferDataMessage *msg);
|
|
|
a547b4 |
+void vdagent_file_xfers_error(struct udscs_connection *vdagentd,
|
|
|
a547b4 |
+ uint32_t msg_id);
|
|
|
a547b4 |
|
|
|
a547b4 |
#endif
|
|
|
a547b4 |
diff --git a/src/vdagent.c b/src/vdagent.c
|
|
|
a547b4 |
index 32c84e5..a0ba79e 100644
|
|
|
a547b4 |
--- a/src/vdagent.c
|
|
|
a547b4 |
+++ b/src/vdagent.c
|
|
|
a547b4 |
@@ -92,6 +92,9 @@ void daemon_read_complete(struct udscs_connection **connp,
|
|
|
a547b4 |
if (vdagent_file_xfers != NULL) {
|
|
|
a547b4 |
vdagent_file_xfers_start(vdagent_file_xfers,
|
|
|
a547b4 |
(VDAgentFileXferStartMessage *)data);
|
|
|
a547b4 |
+ } else {
|
|
|
a547b4 |
+ vdagent_file_xfers_error(*connp,
|
|
|
a547b4 |
+ ((VDAgentFileXferStartMessage *)data)->id);
|
|
|
a547b4 |
}
|
|
|
a547b4 |
free(data);
|
|
|
a547b4 |
break;
|
|
|
a547b4 |
@@ -99,6 +102,9 @@ void daemon_read_complete(struct udscs_connection **connp,
|
|
|
a547b4 |
if (vdagent_file_xfers != NULL) {
|
|
|
a547b4 |
vdagent_file_xfers_status(vdagent_file_xfers,
|
|
|
a547b4 |
(VDAgentFileXferStatusMessage *)data);
|
|
|
a547b4 |
+ } else {
|
|
|
a547b4 |
+ vdagent_file_xfers_error(*connp,
|
|
|
a547b4 |
+ ((VDAgentFileXferStatusMessage *)data)->id);
|
|
|
a547b4 |
}
|
|
|
a547b4 |
free(data);
|
|
|
a547b4 |
break;
|
|
|
a547b4 |
@@ -116,6 +122,9 @@ void daemon_read_complete(struct udscs_connection **connp,
|
|
|
a547b4 |
if (vdagent_file_xfers != NULL) {
|
|
|
a547b4 |
vdagent_file_xfers_data(vdagent_file_xfers,
|
|
|
a547b4 |
(VDAgentFileXferDataMessage *)data);
|
|
|
a547b4 |
+ } else {
|
|
|
a547b4 |
+ vdagent_file_xfers_error(*connp,
|
|
|
a547b4 |
+ ((VDAgentFileXferDataMessage *)data)->id);
|
|
|
a547b4 |
}
|
|
|
a547b4 |
free(data);
|
|
|
a547b4 |
break;
|