Added clipboard transmission notification #4745

This commit is contained in:
Jerry (Xinyu Hou) 2015-06-02 09:48:26 -07:00
parent ce2c797f69
commit d9921c894c
6 changed files with 25 additions and 4 deletions

View File

@ -564,6 +564,12 @@ ServerProxy::setClipboard()
Clipboard clipboard; Clipboard clipboard;
clipboard.unmarshall(dataCached, 0); clipboard.unmarshall(dataCached, 0);
m_client->setClipboard(id, &clipboard); m_client->setClipboard(id, &clipboard);
LOG((CLOG_NOTIFY "Clipboard Transmission Complete: Clipboard is updated."));
}
else if (r == kStart) {
size_t size = ClipboardChunk::getExpectedSize();
LOG((CLOG_NOTIFY "Clipboard Transmission Started: Start receiving %u bytes of clipboard data", size));
} }
} }

View File

@ -91,6 +91,11 @@ ClientProxy1_6::recvClipboard()
info->m_sequenceNumber = seq; info->m_sequenceNumber = seq;
m_events->addEvent(Event(m_events->forClipboard().clipboardChanged(), m_events->addEvent(Event(m_events->forClipboard().clipboardChanged(),
getEventTarget(), info)); getEventTarget(), info));
LOG((CLOG_NOTIFY "Clipboard Transmission Complete: Clipboard is updated"));
}
else if (r == kStart) {
size_t size = ClipboardChunk::getExpectedSize();
LOG((CLOG_NOTIFY "Clipboard Transmission Started: Start receiving %u bytes of clipboard data", size));
} }
return true; return true;

View File

@ -1521,6 +1521,7 @@ Server::onClipboardChanged(BaseClientProxy* sender,
// ignore update if sequence number is old // ignore update if sequence number is old
if (seqNum < clipboard.m_clipboardSeqNum) { if (seqNum < clipboard.m_clipboardSeqNum) {
LOG((CLOG_INFO "ignored screen \"%s\" update of clipboard %d (missequenced)", getName(sender).c_str(), id)); LOG((CLOG_INFO "ignored screen \"%s\" update of clipboard %d (missequenced)", getName(sender).c_str(), id));
LOG((CLOG_NOTIFY "Clipboard Transmission Ignored: Sequence number is old."));
return; return;
} }
@ -1534,6 +1535,7 @@ Server::onClipboardChanged(BaseClientProxy* sender,
String data = clipboard.m_clipboard.marshall(); String data = clipboard.m_clipboard.marshall();
if (data == clipboard.m_clipboardData) { if (data == clipboard.m_clipboardData) {
LOG((CLOG_DEBUG "ignored screen \"%s\" update of clipboard %d (unchanged)", clipboard.m_clipboardOwner.c_str(), id)); LOG((CLOG_DEBUG "ignored screen \"%s\" update of clipboard %d (unchanged)", clipboard.m_clipboardOwner.c_str(), id));
LOG((CLOG_NOTIFY "Clipboard Transmission Ignored: Clipboard data hasn't changed."));
return; return;
} }

View File

@ -22,6 +22,8 @@
#include "io/IStream.h" #include "io/IStream.h"
#include "base/Log.h" #include "base/Log.h"
size_t ClipboardChunk::s_expectedSize = 0;
ClipboardChunk::ClipboardChunk(size_t size) : ClipboardChunk::ClipboardChunk(size_t size) :
Chunk(size) Chunk(size)
{ {
@ -89,7 +91,6 @@ ClipboardChunk::assemble(synergy::IStream* stream,
ClipboardID& id, ClipboardID& id,
UInt32& sequence) UInt32& sequence)
{ {
static size_t expectedSize;
UInt8 mark; UInt8 mark;
String data; String data;
@ -98,7 +99,7 @@ ClipboardChunk::assemble(synergy::IStream* stream,
} }
if (mark == kDataStart) { if (mark == kDataStart) {
expectedSize = synergy::string::stringToSizeType(data); s_expectedSize = synergy::string::stringToSizeType(data);
LOG((CLOG_DEBUG "start receiving clipboard data")); LOG((CLOG_DEBUG "start receiving clipboard data"));
dataCached.clear(); dataCached.clear();
return kNotFinish; return kNotFinish;
@ -112,8 +113,8 @@ ClipboardChunk::assemble(synergy::IStream* stream,
if (id >= kClipboardEnd) { if (id >= kClipboardEnd) {
return kError; return kError;
} }
else if (expectedSize != dataCached.size()) { else if (s_expectedSize != dataCached.size()) {
LOG((CLOG_ERR "corrupted clipboard data, expected size=%d actual size=%d", expectedSize, dataCached.size())); LOG((CLOG_ERR "corrupted clipboard data, expected size=%d actual size=%d", s_expectedSize, dataCached.size()));
return kError; return kError;
} }
return kFinish; return kFinish;

View File

@ -52,4 +52,9 @@ public:
UInt32& sequence); UInt32& sequence);
static void send(synergy::IStream* stream, void* data); static void send(synergy::IStream* stream, void* data);
static size_t getExpectedSize() { return s_expectedSize; }
private:
static size_t s_expectedSize;
}; };

View File

@ -78,6 +78,7 @@ StreamChunker::sendFile(
while (true) { while (true) {
if (s_interruptFile) { if (s_interruptFile) {
s_interruptFile = false; s_interruptFile = false;
LOG((CLOG_NOTIFY "File Transmission Interrupted: The previous file transmission is interrupted."));
break; break;
} }
@ -142,6 +143,7 @@ StreamChunker::sendClipboard(
while (true) { while (true) {
if (s_interruptClipboard) { if (s_interruptClipboard) {
s_interruptClipboard = false; s_interruptClipboard = false;
LOG((CLOG_NOTIFY "Clipboard Transmission Interrupted: The previous clipboard transmission is interrupted."));
break; break;
} }