Commit 633f0105 authored by Pavel Grunt's avatar Pavel Grunt Committed by Jeremy White

Split agent data message into smaller chunks

Allowed size for SPICE_MSGC_MAIN_AGENT_DATA message is 2048 Bytes,
larger messages have to be splitted.
parent 1a4a9893
......@@ -312,6 +312,7 @@ var SPICE_CURSOR_TYPE_ALPHA = 0,
var SPICE_VIDEO_CODEC_TYPE_MJPEG = 1;
var VD_AGENT_PROTOCOL = 1;
var VD_AGENT_MAX_DATA_SIZE = 2048;
var VD_AGENT_MOUSE_STATE = 1,
VD_AGENT_MONITORS_CONFIG = 2,
......
......@@ -224,9 +224,19 @@ SpiceMainConn.prototype.send_agent_message_queue = function(message)
SpiceMainConn.prototype.send_agent_message = function(type, message)
{
var agent_data = new SpiceMsgcMainAgentData(type, message);
var mr = new SpiceMiniData();
mr.build_msg(SPICE_MSGC_MAIN_AGENT_DATA, agent_data);
this.send_agent_message_queue(mr);
var sb = 0, maxsize = VD_AGENT_MAX_DATA_SIZE - SpiceMiniData.prototype.buffer_size();
var data = new ArrayBuffer(agent_data.buffer_size());
agent_data.to_buffer(data);
while (sb < agent_data.buffer_size())
{
var eb = Math.min(sb + maxsize, agent_data.buffer_size());
var mr = new SpiceMiniData();
mr.type = SPICE_MSGC_MAIN_AGENT_DATA;
mr.size = eb - sb;
mr.data = data.slice(sb, eb);
this.send_agent_message_queue(mr);
sb = eb;
}
}
SpiceMainConn.prototype.resize_window = function(flags, width, height, depth, x, y)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment