fixed recorder (message init logic broke it)

added some handling for pixel format changes
This commit is contained in:
amit bezalel
2017-07-12 01:06:02 +03:00
parent 18bef62b79
commit fe51682a55
13 changed files with 401 additions and 351 deletions

View File

@@ -493,18 +493,20 @@ func (c *ClientConn) mainLoop() {
}
}
defer func(){
defer func() {
logger.Warn("ClientConn.MainLoop: exiting!")
}()
for {
var messageType uint8
if err := binary.Read(c.conn, binary.BigEndian, &messageType); err != nil {
logger.Errorf("ClientConn.MainLoop: error reading messagetype, %s", err)
break
}
msg, ok := typeMap[messageType]
if !ok {
logger.Errorf("ClientConn.MainLoop: bad message type, %d", messageType)
// Unsupported message type! Bad!
break
}
@@ -514,9 +516,10 @@ func (c *ClientConn) mainLoop() {
parsedMsg, err := msg.Read(c, reader)
if err != nil {
logger.Errorf("ClientConn.MainLoop: error parsing message, %s", err)
break
}
logger.Debugf("ClientConn.MainLoop: read & parsed ServerMessage:%s, %v", parsedMsg.Type(), parsedMsg)
logger.Debugf("ClientConn.MainLoop: read & parsed ServerMessage:%d, %s", parsedMsg.Type(), parsedMsg)
if c.config.ServerMessageCh == nil {
continue

View File

@@ -5,10 +5,10 @@ import (
"encoding/json"
"fmt"
"io"
"strings"
"vncproxy/common"
"vncproxy/encodings"
"vncproxy/logger"
"strings"
)
// FramebufferUpdateMessage consists of a sequence of rectangles of
@@ -90,6 +90,7 @@ func (fbm *FramebufferUpdateMessage) Read(c common.IClientConn, r *common.RfbRea
if strings.Contains(encType.String(), "Pseudo") {
rect.Enc = &encodings.PseudoEncoding{encodingTypeInt}
} else {
logger.Errorf("unsupported encoding type: %d, %s", encodingTypeInt, encType)
return nil, fmt.Errorf("unsupported encoding type: %d, %s", encodingTypeInt, encType)
}
@@ -100,10 +101,6 @@ func (fbm *FramebufferUpdateMessage) Read(c common.IClientConn, r *common.RfbRea
return &FramebufferUpdateMessage{rects}, nil
}
// SetColorMapEntriesMessage is sent by the server to set values into
// the color map. This message will automatically update the color map
// for the associated connection, but contains the color change data