fix negative result in auth

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
Василий Толстов 2017-07-10 23:16:47 +03:00
parent 88b99c68a5
commit 5ad25a5873

View File

@ -212,10 +212,14 @@ func (*DefaultServerSecurityHandler) Handle(c Conn) error {
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 authErr == nil {
if err := c.Flush(); err != nil { if err := c.Flush(); err != nil {
return err return err
} }
if authErr != nil { c.SetSecurityHandler(sType)
return nil
}
if err := binary.Write(c, binary.BigEndian, uint32(len(authErr.Error()))); err != nil { if err := binary.Write(c, binary.BigEndian, uint32(len(authErr.Error()))); err != nil {
return err return err
} }
@ -226,9 +230,6 @@ func (*DefaultServerSecurityHandler) Handle(c Conn) error {
return err return err
} }
return authErr return authErr
}
c.SetSecurityHandler(sType)
return nil
} }
// DefaultClientServerInitHandler default client server init handler // DefaultClientServerInitHandler default client server init handler