summaryrefslogtreecommitdiff
path: root/vdagent
diff options
context:
space:
mode:
authorArnon Gilboa <agilboa@redhat.com>2013-05-08 17:55:40 +0300
committerArnon Gilboa <agilboa@redhat.com>2013-05-09 14:19:11 +0300
commitb72b943309089a0c9340969f4c5bbea2e1500236 (patch)
treea3a270f984e81f67531934b3008bfa7069062973 /vdagent
parente55103589a62460a1128625740ec8c9126adeb64 (diff)
vdagent: drop clipboard received after timeout
rhbz #951618
Diffstat (limited to 'vdagent')
-rw-r--r--vdagent/vdagent.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index 68b311e..75291b0 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -984,9 +984,12 @@ void VDAgent::on_clipboard_request(UINT format)
event_dispatcher(VD_CLIPBOARD_TIMEOUT_MS, 0);
}
- cleanup_in_msg();
if (_clipboard_tick) {
vd_printf("Clipboard wait timeout");
+ _clipboard_tick = 0;
+ } else {
+ // reset incoming message state only upon completion (even after timeout)
+ cleanup_in_msg();
}
}
@@ -1308,11 +1311,15 @@ void VDAgent::handle_chunk(VDIChunk* chunk)
memcpy((uint8_t*)_in_msg + _in_msg_pos, chunk->data, chunk->hdr.size);
_in_msg_pos += chunk->hdr.size;
// update clipboard tick on each clipboard chunk for timeout setting
- if (_in_msg->type == VD_AGENT_CLIPBOARD) {
+ if (_in_msg->type == VD_AGENT_CLIPBOARD && _clipboard_tick) {
_clipboard_tick = GetTickCount();
}
if (_in_msg_pos == sizeof(VDAgentMessage) + _in_msg->size) {
- dispatch_message(_in_msg, 0);
+ if (_in_msg->type == VD_AGENT_CLIPBOARD && !_clipboard_tick) {
+ vd_printf("Clipboard received but dropped due to timeout");
+ } else {
+ dispatch_message(_in_msg, 0);
+ }
cleanup_in_msg();
}
}