Skip to content

Commit

Permalink
remove some useless code introduced since ota support
Browse files Browse the repository at this point in the history
  • Loading branch information
ayanamist committed Dec 16, 2015
1 parent 186bb44 commit cb20fe4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
4 changes: 0 additions & 4 deletions cmd/shadowsocks-server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ const logCntDelta = 100
var connCnt int
var nextLogConnCnt int = logCntDelta

type isClosed struct {
isClosed bool
}

func handleConnection(conn *ss.Conn, auth bool) {
var host string

Expand Down
7 changes: 1 addition & 6 deletions shadowsocks/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,7 @@ func (c *Cipher) initEncrypt() (iv []byte, err error) {
} else {
iv = c.iv
}
if c.enc == nil {
c.enc, err = c.info.newStream(c.key, iv, Encrypt)
if err != nil {
return nil, err
}
}
c.enc, err = c.info.newStream(c.key, iv, Encrypt)
return
}

Expand Down
6 changes: 2 additions & 4 deletions shadowsocks/pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ func PipeThenCloseOta(src *Conn, dst net.Conn) {
// sometimes it have to fill large block
buf := leakyBuf.Get()
defer leakyBuf.Put(buf)
i := 0
for {
i += 1
for i := 1; ; i += 1 {
SetReadTimeout(src)
if n, err := io.ReadFull(src, buf[:dataLenLen+hmacSha1Len]); err != nil {
if err == io.EOF {
Expand All @@ -77,7 +75,7 @@ func PipeThenCloseOta(src *Conn, dst net.Conn) {
if len(buf) < int(idxData0+dataLen) {
dataBuf = make([]byte, dataLen)
} else {
dataBuf = buf[idxData0:idxData0+dataLen]
dataBuf = buf[idxData0 : idxData0+dataLen]
}
if n, err := io.ReadFull(src, dataBuf); err != nil {
if err == io.EOF {
Expand Down

0 comments on commit cb20fe4

Please sign in to comment.