mirror of https://github.com/schollz/croc.git
Merge pull request #337 from alrs/alrs-fix-server-nil-salt-and-keys
src/tcp: fix dropped errors
This commit is contained in:
commit
6e9156d49c
|
@ -170,6 +170,9 @@ func (s *server) clientCommunication(port string, c *comm.Comm) (room string, er
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = c.Send(B.Bytes())
|
err = c.Send(B.Bytes())
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
Abytes, err = c.Receive()
|
Abytes, err = c.Receive()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -186,6 +189,9 @@ func (s *server) clientCommunication(port string, c *comm.Comm) (room string, er
|
||||||
|
|
||||||
// receive salt
|
// receive salt
|
||||||
salt, err := c.Receive()
|
salt, err := c.Receive()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
strongKeyForEncryption, _, err := crypt.New(strongKey, salt)
|
strongKeyForEncryption, _, err := crypt.New(strongKey, salt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -446,6 +452,9 @@ func ConnectToTCPServer(address, password, room string, timelimit ...time.Durati
|
||||||
log.Debugf("strong key: %x", strongKey)
|
log.Debugf("strong key: %x", strongKey)
|
||||||
|
|
||||||
strongKeyForEncryption, salt, err := crypt.New(strongKey, nil)
|
strongKeyForEncryption, salt, err := crypt.New(strongKey, nil)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
// send salt
|
// send salt
|
||||||
err = c.Send(salt)
|
err = c.Send(salt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue