Skip to content

Commit

Permalink
Merge pull request #40 from xssnick/tests
Browse files Browse the repository at this point in the history
Tests
  • Loading branch information
xssnick authored Jun 17, 2022
2 parents 12a00d3 + dc03318 commit 281140f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions liteclient/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"io"
"math/big"
"net"
"sync"
"time"

"github.com/xssnick/tonutils-go/utils"
Expand All @@ -28,6 +29,7 @@ type node struct {
conn net.Conn
rCrypt cipher.Stream
wCrypt cipher.Stream
wLock sync.Mutex

reqs chan *LiteRequest

Expand Down Expand Up @@ -281,6 +283,9 @@ func (n *node) send(data []byte) error {

buf = append(buf, checksum...)

n.wLock.Lock()
defer n.wLock.Unlock()

// encrypt data
n.wCrypt.XORKeyStream(buf, buf)

Expand Down

0 comments on commit 281140f

Please sign in to comment.