0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

tcp: send error on fail

This commit is contained in:
Zack Scholl 2022-02-23 08:03:45 -08:00
parent 53f35c1da0
commit 635b362ca0

View file

@ -226,7 +226,7 @@ func (s *server) clientCommunication(port string, c *comm.Comm) (room string, er
} }
if strings.TrimSpace(string(passwordBytes)) != s.password { if strings.TrimSpace(string(passwordBytes)) != s.password {
err = fmt.Errorf("bad password") err = fmt.Errorf("bad password")
enc, _ := crypt.Decrypt([]byte(err.Error()), strongKeyForEncryption) enc, _ := crypt.Encrypt([]byte(err.Error()), strongKeyForEncryption)
if err := c.Send(enc); err != nil { if err := c.Send(enc); err != nil {
return "", fmt.Errorf("send error: %w", err) return "", fmt.Errorf("send error: %w", err)
} }