mirror of https://github.com/cbeuw/Cloak
Minor code cleanup
This commit is contained in:
parent
86214a1df0
commit
bbc0752883
2
go.mod
2
go.mod
|
|
@ -5,7 +5,7 @@ go 1.12
|
|||
require (
|
||||
github.com/Yawning/chacha20 v0.0.0-20170904085104-e3b1f968fc63 // indirect
|
||||
github.com/boltdb/bolt v1.3.1
|
||||
github.com/cbeuw/connutil v0.0.0-20200407195302-dc6b6ca97482
|
||||
github.com/cbeuw/connutil v0.0.0-20200409111716-0d24ac34e5c1
|
||||
github.com/gorilla/mux v1.7.3
|
||||
github.com/gorilla/websocket v1.4.1
|
||||
github.com/juju/ratelimit v1.0.1
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -4,6 +4,8 @@ github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
|
|||
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
|
||||
github.com/cbeuw/connutil v0.0.0-20200407195302-dc6b6ca97482 h1:FHwIeZZdzILmajXl+o1ac3vjoOtaWKLR9wzw2eAELGU=
|
||||
github.com/cbeuw/connutil v0.0.0-20200407195302-dc6b6ca97482/go.mod h1:6jR2SzckGv8hIIS9zWJ160mzGVVOYp4AXZMDtacL6LE=
|
||||
github.com/cbeuw/connutil v0.0.0-20200409111716-0d24ac34e5c1 h1:hT1LH3jDPIgID4+/RInd4ze7NDeB1Gr/aRtrZAZhChs=
|
||||
github.com/cbeuw/connutil v0.0.0-20200409111716-0d24ac34e5c1/go.mod h1:6jR2SzckGv8hIIS9zWJ160mzGVVOYp4AXZMDtacL6LE=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
|
||||
|
|
|
|||
|
|
@ -81,12 +81,6 @@ func (p *bufferedPipe) Close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *bufferedPipe) Len() int {
|
||||
p.rwCond.L.Lock()
|
||||
defer p.rwCond.L.Unlock()
|
||||
return p.buf.Len()
|
||||
}
|
||||
|
||||
func (p *bufferedPipe) SetReadDeadline(t time.Time) {
|
||||
p.rwCond.L.Lock()
|
||||
defer p.rwCond.L.Unlock()
|
||||
|
|
|
|||
|
|
@ -73,8 +73,7 @@ func (sb *switchboard) send(data []byte, connId *uint32) (n int, err error) {
|
|||
}
|
||||
|
||||
sb.valve.txWait(len(data))
|
||||
connCount := sb.connsCount()
|
||||
if atomic.LoadUint32(&sb.broken) == 1 || connCount == 0 {
|
||||
if atomic.LoadUint32(&sb.broken) == 1 || sb.connsCount() == 0 {
|
||||
return 0, errBrokenSwitchboard
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue