fix error path in security handler
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
parent
43703cb18d
commit
d98d2dfc52
@ -205,16 +205,14 @@ func (*DefaultServerSecurityHandler) Handle(c Conn) error {
|
|||||||
if authErr != nil {
|
if authErr != nil {
|
||||||
authCode = uint32(1)
|
authCode = uint32(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := binary.Write(c, binary.BigEndian, authCode); err != nil {
|
if err := binary.Write(c, binary.BigEndian, authCode); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := c.Flush(); err != nil {
|
if err := c.Flush(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if authErr != nil {
|
if authErr != nil {
|
||||||
if err := binary.Write(c, binary.BigEndian, len(authErr.Error())); err != nil {
|
if err := binary.Write(c, binary.BigEndian, uint32(len(authErr.Error()))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := binary.Write(c, binary.BigEndian, []byte(authErr.Error())); err != nil {
|
if err := binary.Write(c, binary.BigEndian, []byte(authErr.Error())); err != nil {
|
||||||
@ -225,14 +223,13 @@ func (*DefaultServerSecurityHandler) Handle(c Conn) error {
|
|||||||
}
|
}
|
||||||
return authErr
|
return authErr
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type DefaultClientServerInitHandler struct{}
|
type DefaultClientServerInitHandler struct{}
|
||||||
|
|
||||||
func (*DefaultClientServerInitHandler) Handle(c Conn) error {
|
func (*DefaultClientServerInitHandler) Handle(c Conn) error {
|
||||||
srvInit := &ServerInit{}
|
srvInit := ServerInit{}
|
||||||
|
|
||||||
if err := binary.Read(c, binary.BigEndian, &srvInit.FBWidth); err != nil {
|
if err := binary.Read(c, binary.BigEndian, &srvInit.FBWidth); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -258,7 +255,6 @@ func (*DefaultClientServerInitHandler) Handle(c Conn) error {
|
|||||||
c.SetHeight(srvInit.FBHeight)
|
c.SetHeight(srvInit.FBHeight)
|
||||||
c.SetPixelFormat(&srvInit.PixelFormat)
|
c.SetPixelFormat(&srvInit.PixelFormat)
|
||||||
|
|
||||||
fmt.Printf("%s\n", srvInit)
|
|
||||||
if c.Protocol() == "aten" {
|
if c.Protocol() == "aten" {
|
||||||
ikvm := struct {
|
ikvm := struct {
|
||||||
_ [8]byte
|
_ [8]byte
|
||||||
|
Loading…
Reference in New Issue
Block a user