Soheil Hassas Yeganeh
e09914bfa3
Use the readable indentation for error flow
2016-02-27 13:04:49 -05:00
Soheil Hassas Yeganeh
d710784914
Merge pull request #20 from tamird/fix-read-again
...
(*MuxConn).Read: fix erroneous io.EOF return
2016-02-25 23:16:54 -05:00
Tamir Duberstein
49c66ff242
(*MuxConn).Read: fix erroneous io.EOF return
...
This fixes a bug where (*MuxConn).Read would return io.EOF if the
buffer was exactly the right size to fill the passed-in slice.
2016-02-25 21:59:10 -05:00
Soheil Hassas Yeganeh
d8cc6481fa
Merge pull request #18 from tamird/vet-shadow
...
`go tool vet --shadow .`
2016-02-25 12:04:36 -05:00
Soheil Hassas Yeganeh
23074f6929
Merge pull request #17 from tamird/fix-write
...
buffer: do not retain passed-in memory
2016-02-25 12:03:57 -05:00
Tamir Duberstein
180c9ac049
go tool vet --shadow .
2016-02-25 11:47:10 -05:00
Tamir Duberstein
48443df968
buffer: do not retain passed-in memory
...
This is in violation of the io.Writer interface specification.
2016-02-25 11:40:31 -05:00
Soheil Hassas Yeganeh
1a2fcbde3a
Merge pull request #16 from soheilhy/devel
...
Close the connections buffered for the listeners
2016-02-23 23:05:27 -05:00
Soheil Hassas Yeganeh
6f986603b0
Close the connections buffered for the listeners
...
This commit closes the connections that has been buffered
on the connection channel of the cmux listeners, when the
root listener is closed. With this change it is guaranteed
that the connections are either closed or handed of to the
child listeners (returned via Accept()).
There are a couple of changes to the tests to cover corner
cases and the new behavior.
2016-02-23 23:01:35 -05:00
Soheil Hassas Yeganeh
2625710699
Merge pull request #13 from tamird/fix-http2
...
http2: use io.ReadFull
2016-02-23 11:27:28 -05:00
Tamir Duberstein
204cc45a24
http2: use io.ReadFull
...
This fixes an issue where an earlier matcher does not sufficiently
populate the buffer, preventing HTTP2 from reading enough bytes on the
Read call.
2016-02-23 11:25:36 -05:00
Soheil Hassas Yeganeh
99ee7b080d
Merge pull request #12 from tamird/fix-read
...
Reduce the number of calls needed to (*MuxConn).Read
2016-02-23 11:20:36 -05:00
Soheil Hassas Yeganeh
d5b9190ea9
Merge pull request #11 from tamird/fix-close
...
Tweak shutdown behaviour
2016-02-23 11:20:27 -05:00
Tamir Duberstein
235d98b021
Tweak shutdown behaviour
...
When the root listener is closed, child listeners will not be closed
until all parked connections are served. This prevents losing
connections that have been read from.
This also allows moving the main test to package cmux_test, but that
will happen in a separate change.
2016-02-23 11:13:16 -05:00
Tamir Duberstein
9a9119af9d
fix flaky test TestErrorHandler
...
Before this change, this test would fail after about 50 runs. After
this change, I was able to run it 200 times without failure.
2016-02-23 11:06:01 -05:00
Tamir Duberstein
6490dea199
Reduce the number of calls needed to (*MuxConn).Read
...
Also affects (*buffer).Read.
2016-02-23 09:49:37 -05:00
Soheil Hassas Yeganeh
95fd8b5c56
Merge pull request #10 from tamird/cleanup-error-handler
...
TestErrorHandler: assert that the error handler runs
2016-02-22 22:47:19 -05:00
Tamir Duberstein
15b1cf90b1
TestErrorHandler: assert that the error handler runs
...
Also fixes a race condition using an atomic and adds the race detector
to Travis CI.
2016-02-22 22:33:02 -05:00
Soheil Hassas Yeganeh
4796322bac
Merge pull request #8 from tamird/fix-leaks
...
fix test-only goroutine leaks
2016-02-22 22:25:32 -05:00
Tamir Duberstein
e5e53dfc73
avoid (*testing.T).FailNow
in non-main goroutines
2016-02-22 22:13:34 -05:00
Tamir Duberstein
ffd8d50a7c
fix test-only goroutine leaks
...
This makes real test failures' stack traces much easier to read.
2016-02-22 22:13:34 -05:00
Soheil Hassas Yeganeh
fd2424be4b
Merge pull request #9 from tamird/DRY
...
Refactor redundant code.
2016-02-22 22:02:58 -05:00
Soheil Hassas Yeganeh
dcd94116ef
Merge pull request #7 from tamird/vet
...
Add `go vet` to Travis CI
2016-02-22 21:43:55 -05:00
Tamir Duberstein
5746da9df6
DRY
2016-02-21 12:59:08 -05:00
Tamir Duberstein
93090fcbbc
Add go vet
to Travis CI
2016-02-21 12:39:43 -05:00
Tamir Duberstein
b5e73ea381
remove named returns and useless closures
2016-02-21 12:09:02 -05:00
Tamir Duberstein
ecc37f82cd
let the kernel assign ports
2016-02-21 12:07:55 -05:00
Tamir Duberstein
4f1b8abafd
Add Go 1.5 & 1.6 to Travis CI
2016-02-21 12:02:55 -05:00
Tamir Duberstein
92a63c4fce
errcheck
...
go/src/github.com/soheilhy/cmux/cmux.go:127:13 c.Close()
go/src/github.com/soheilhy/cmux/cmux.go:134:9 c.Close()
go/src/github.com/soheilhy/cmux/cmux.go:137:15 m.root.Close()
go/src/github.com/soheilhy/cmux/cmux_test.go:43:9 s.Serve(l)
go/src/github.com/soheilhy/cmux/cmux_test.go:52:20 defer r.Body.Close()
go/src/github.com/soheilhy/cmux/cmux_test.go:72:12 s.Register(TestRPCRcvr{})
go/src/github.com/soheilhy/cmux/cmux_test.go:103:15 defer l.Close()
go/src/github.com/soheilhy/cmux/cmux_test.go:109:15 go muxl.Serve()
go/src/github.com/soheilhy/cmux/cmux_test.go:116:20 defer r.Body.Close()
go/src/github.com/soheilhy/cmux/cmux_test.go:125:15 defer l.Close()
go/src/github.com/soheilhy/cmux/cmux_test.go:133:15 go muxl.Serve()
go/src/github.com/soheilhy/cmux/cmux_test.go:141:15 defer l.Close()
go/src/github.com/soheilhy/cmux/cmux_test.go:147:15 go muxl.Serve()
go/src/github.com/soheilhy/cmux/example_recursive_test.go:27:9 s.Serve(l)
go/src/github.com/soheilhy/cmux/example_recursive_test.go:56:12 s.Register(&RecursiveRPCRcvr{})
go/src/github.com/soheilhy/cmux/example_recursive_test.go:88:15 go tlsm.Serve()
go/src/github.com/soheilhy/cmux/example_recursive_test.go:89:12 tcpm.Serve()
go/src/github.com/soheilhy/cmux/example_test.go:30:9 s.Serve(l)
go/src/github.com/soheilhy/cmux/example_test.go:34:9 io.Copy(ws, ws)
go/src/github.com/soheilhy/cmux/example_test.go:41:9 s.Serve(l)
go/src/github.com/soheilhy/cmux/example_test.go:53:12 s.Register(&ExampleRPCRcvr{})
go/src/github.com/soheilhy/cmux/example_test.go:68:13 grpcs.Serve(l)
go/src/github.com/soheilhy/cmux/example_test.go:97:9 m.Serve()
go/src/github.com/soheilhy/cmux/example_tls_test.go:24:9 s.Serve(l)
go/src/github.com/soheilhy/cmux/example_tls_test.go:69:9 m.Serve()
go/src/github.com/soheilhy/cmux/matchers.go:151:14 hdec.Write(f.HeaderBlockFragment())
2016-02-21 12:02:37 -05:00
Soheil Hassas Yeganeh
ec462e9c0e
Replace log.Fatal with log.Panic
2016-02-21 10:46:12 -05:00
Tamir Duberstein
6c298ce7b1
Simplify formatting in patricia.go
...
`gofmt -s -w .`
2016-02-21 10:41:14 -05:00
Soheil Hassas Yeganeh
3ca13bcd9e
Remove the unncessary var and const blocks
2016-02-21 10:37:29 -05:00
Tamir Duberstein
48deeb47a3
golint
...
cmux.go:28:1: exported method ErrNotMatched.Temporary should have comment or be unexported
cmux.go:29:1: exported method ErrNotMatched.Timeout should have comment or be unexported
cmux.go:38:2: exported var ErrListenerClosed should have comment or be unexported
cmux.go:165:6: exported type MuxConn should have comment or be unexported
2016-02-21 10:34:32 -05:00
Tamir Duberstein
05566d752e
vet: buffer_test.go:65: possible formatting directive in Fatal call
2016-02-21 10:33:47 -05:00
Soheil Hassas Yeganeh
345ba38c5f
Merge pull request #6 from emosbaugh/flag_parse_in_library
...
rely on project to call flag.Parse rather than when used as library
2016-02-20 13:50:53 -05:00
Ethan Mosbaugh
4ebe86a5a2
rely on project to call flag.Parse rather than when used as library
2016-02-09 07:53:32 -08:00
Tamir Duberstein
563c371a98
Cleanup code in cmux and bench_test.
...
This commit is a partial cherry pick of pull request #3 , for code cleanup.
2015-12-19 22:37:27 -05:00
Soheil Hassas Yeganeh
89dd8ce1fd
Return an error in Accept() when root is closed.
...
As reported in #4 , when the root listener is closed, calling Accept
on mux'd listeners would block forever, instead of returning an error.
This is because of a bug introduced in b90740d
.
This commit fixes #4 by selecting on both donec and connc of muxed
listeners.
Added a test case to guard against this issue.
2015-12-19 22:28:37 -05:00
Soheil Hassas Yeganeh
44439c27f0
Merge pull request #2 from tamird/update-readme-reasons
...
README: clarify why TLS is limited
2015-12-13 15:36:20 -05:00
Tamir Duberstein
4239e597d0
README: clarify why TLS is limited
2015-12-11 15:22:57 -05:00
Dmitri Shuralyov
44b568c84b
Update to correct vanity import paths.
...
The latest canonical import path for http2 package is
"golang.org/x/net/http2".
The latest canonical import path for grpc examples is
"google.golang.org/grpc/examples/...".
2015-11-25 23:19:45 -05:00
Soheil Hassas Yeganeh
1734b4cc90
Change the import path to the new grpc-go repo
...
gRPC examples have been migrated from the grpc-common repo to their
language-specific repos. This commit uses the new import path.
2015-08-30 21:15:41 -04:00
Soheil Hassas Yeganeh
b90740dfa9
Fix send on closed channel
...
If a matcher go-routine mateches a connection after the root
listener was closed, cmux will panic since all connection channels
will be closed. This commit avoids closing connection channels but
signals the matcher go-routines that the listener is closed via
a done channel.
Tested: Added a test case for this issue.
2015-08-30 21:10:18 -04:00
Soheil Hassas Yeganeh
d47edebeb9
Add websocket example
...
This commit fixes #1 and adds an example matcher for websocket.
2015-08-05 17:32:32 -04:00
Soheil Hassas Yeganeh
a6c45318a5
Nit in README
2015-08-01 12:44:34 -04:00
Soheil Hassas Yeganeh
51556c6df5
Add an example for recursive muxing
2015-08-01 12:08:59 -04:00
Soheil Hassas Yeganeh
fbd0877935
Use a custom buffer intead of buffers from bytes
...
This commit implements a new buffer that eliminates a few copies.
2015-08-01 11:59:50 -04:00
Soheil Hassas Yeganeh
77815df398
Add micro-benchmarks
2015-08-01 11:57:42 -04:00
Soheil Hassas Yeganeh
5b048e6641
Add the license file
2015-08-01 10:36:36 -04:00
Soheil Hassas Yeganeh
09b35f69d5
Remove trailing spaces in README
2015-07-31 19:57:20 -04:00