Revert "Add keepAlive message before send file/clipboard data #4768"
This reverts commit 5287c62540b277474603ea8a38c53b50cb8f4d52.
This commit is contained in:
parent
b5b2cdfade
commit
7cbd3fdcb4
|
@ -198,3 +198,4 @@ REGISTER_EVENT(Clipboard, clipboardSending)
|
||||||
|
|
||||||
REGISTER_EVENT(File, fileChunkSending)
|
REGISTER_EVENT(File, fileChunkSending)
|
||||||
REGISTER_EVENT(File, fileRecieveCompleted)
|
REGISTER_EVENT(File, fileRecieveCompleted)
|
||||||
|
REGISTER_EVENT(File, keepAlive)
|
||||||
|
|
|
@ -712,7 +712,8 @@ class FileEvents : public EventTypes {
|
||||||
public:
|
public:
|
||||||
FileEvents() :
|
FileEvents() :
|
||||||
m_fileChunkSending(Event::kUnknown),
|
m_fileChunkSending(Event::kUnknown),
|
||||||
m_fileRecieveCompleted(Event::kUnknown) { }
|
m_fileRecieveCompleted(Event::kUnknown),
|
||||||
|
m_keepAlive(Event::kUnknown) { }
|
||||||
|
|
||||||
//! @name accessors
|
//! @name accessors
|
||||||
//@{
|
//@{
|
||||||
|
@ -723,9 +724,13 @@ public:
|
||||||
//! Completed receiving a file
|
//! Completed receiving a file
|
||||||
Event::Type fileRecieveCompleted();
|
Event::Type fileRecieveCompleted();
|
||||||
|
|
||||||
|
//! Send a keep alive
|
||||||
|
Event::Type keepAlive();
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Event::Type m_fileChunkSending;
|
Event::Type m_fileChunkSending;
|
||||||
Event::Type m_fileRecieveCompleted;
|
Event::Type m_fileRecieveCompleted;
|
||||||
|
Event::Type m_keepAlive;
|
||||||
};
|
};
|
||||||
|
|
|
@ -252,7 +252,9 @@ ServerProxy::parseMessage(const UInt8* code)
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (memcmp(code, kMsgCKeepAlive, 4) == 0) {
|
else if (memcmp(code, kMsgCKeepAlive, 4) == 0) {
|
||||||
keepAlive();
|
// echo keep alives and reset alarm
|
||||||
|
ProtocolUtil::writef(m_stream, kMsgCKeepAlive);
|
||||||
|
resetKeepAliveAlarm();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (memcmp(code, kMsgCNoop, 4) == 0) {
|
else if (memcmp(code, kMsgCNoop, 4) == 0) {
|
||||||
|
@ -890,21 +892,12 @@ ServerProxy::dragInfoReceived()
|
||||||
void
|
void
|
||||||
ServerProxy::handleClipboardSendingEvent(const Event& event, void*)
|
ServerProxy::handleClipboardSendingEvent(const Event& event, void*)
|
||||||
{
|
{
|
||||||
keepAlive();
|
|
||||||
ClipboardChunk::send(m_stream, event.getData());
|
ClipboardChunk::send(m_stream, event.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerProxy::keepAlive()
|
|
||||||
{
|
|
||||||
// echo keep alives and reset alarm
|
|
||||||
ProtocolUtil::writef(m_stream, kMsgCKeepAlive);
|
|
||||||
resetKeepAliveAlarm();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerProxy::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
|
ServerProxy::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
|
||||||
{
|
{
|
||||||
keepAlive();
|
|
||||||
FileChunk::send(m_stream, mark, data, dataSize);
|
FileChunk::send(m_stream, mark, data, dataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,6 @@ private:
|
||||||
void fileChunkReceived();
|
void fileChunkReceived();
|
||||||
void dragInfoReceived();
|
void dragInfoReceived();
|
||||||
void handleClipboardSendingEvent(const Event&, void*);
|
void handleClipboardSendingEvent(const Event&, void*);
|
||||||
void keepAlive();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef EResult (ServerProxy::*MessageParser)(const UInt8*);
|
typedef EResult (ServerProxy::*MessageParser)(const UInt8*);
|
||||||
|
|
|
@ -35,10 +35,16 @@ ClientProxy1_5::ClientProxy1_5(const String& name, synergy::IStream* stream, Ser
|
||||||
ClientProxy1_4(name, stream, server, events),
|
ClientProxy1_4(name, stream, server, events),
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
m_events->adoptHandler(m_events->forFile().keepAlive(),
|
||||||
|
this,
|
||||||
|
new TMethodEventJob<ClientProxy1_3>(this,
|
||||||
|
&ClientProxy1_3::handleKeepAlive, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientProxy1_5::~ClientProxy1_5()
|
ClientProxy1_5::~ClientProxy1_5()
|
||||||
{
|
{
|
||||||
|
m_events->removeHandler(m_events->forFile().keepAlive(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -52,7 +58,6 @@ ClientProxy1_5::sendDragInfo(UInt32 fileCount, const char* info, size_t size)
|
||||||
void
|
void
|
||||||
ClientProxy1_5::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
|
ClientProxy1_5::fileChunkSending(UInt8 mark, char* data, size_t dataSize)
|
||||||
{
|
{
|
||||||
keepAlive();
|
|
||||||
FileChunk::send(getStream(), mark, data, dataSize);
|
FileChunk::send(getStream(), mark, data, dataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,12 +50,6 @@ ClientProxy1_6::setClipboard(ClipboardID id, const IClipboard* clipboard)
|
||||||
if (m_clipboard[id].m_dirty) {
|
if (m_clipboard[id].m_dirty) {
|
||||||
// this clipboard is now clean
|
// this clipboard is now clean
|
||||||
m_clipboard[id].m_dirty = false;
|
m_clipboard[id].m_dirty = false;
|
||||||
|
|
||||||
// add keep alive message before we do clipboard copy
|
|
||||||
// in case there is a big data inside and time that would
|
|
||||||
// comsume will cause connecton being dropped
|
|
||||||
keepAlive();
|
|
||||||
|
|
||||||
Clipboard::copy(&m_clipboard[id].m_clipboard, clipboard);
|
Clipboard::copy(&m_clipboard[id].m_clipboard, clipboard);
|
||||||
|
|
||||||
String data = m_clipboard[id].m_clipboard.marshall();
|
String data = m_clipboard[id].m_clipboard.marshall();
|
||||||
|
@ -72,9 +66,6 @@ ClientProxy1_6::setClipboard(ClipboardID id, const IClipboard* clipboard)
|
||||||
void
|
void
|
||||||
ClientProxy1_6::handleClipboardSendingEvent(const Event& event, void*)
|
ClientProxy1_6::handleClipboardSendingEvent(const Event& event, void*)
|
||||||
{
|
{
|
||||||
// add keep alive message before we send each clipboard data
|
|
||||||
keepAlive();
|
|
||||||
|
|
||||||
ClipboardChunk::send(getStream(), event.getData());
|
ClipboardChunk::send(getStream(), event.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,8 @@ StreamChunker::sendFile(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sendStopwatch.getTime() > SEND_THRESHOLD) {
|
if (sendStopwatch.getTime() > SEND_THRESHOLD) {
|
||||||
|
events->addEvent(Event(events->forFile().keepAlive(), eventTarget));
|
||||||
|
|
||||||
// make sure we don't read too much from the mock data.
|
// make sure we don't read too much from the mock data.
|
||||||
if (sentLength + chunkSize > size) {
|
if (sentLength + chunkSize > size) {
|
||||||
chunkSize = size - sentLength;
|
chunkSize = size - sentLength;
|
||||||
|
@ -149,6 +151,8 @@ StreamChunker::sendClipboard(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sendStopwatch.getTime() > SEND_THRESHOLD) {
|
if (sendStopwatch.getTime() > SEND_THRESHOLD) {
|
||||||
|
events->addEvent(Event(events->forFile().keepAlive(), eventTarget));
|
||||||
|
|
||||||
// make sure we don't read too much from the mock data.
|
// make sure we don't read too much from the mock data.
|
||||||
if (sentLength + chunkSize > size) {
|
if (sentLength + chunkSize > size) {
|
||||||
chunkSize = size - sentLength;
|
chunkSize = size - sentLength;
|
||||||
|
|
Loading…
Reference in New Issue