Update go dep (#1560)

This fix updates go dep with `dep ensure --update` as well as the following:
- Removed github.com/ugorji/go restriction in Gopkg.toml (fixes  #1557)
- Added github.com/flynn/go-shlex in Makefile (neede by Caddy, maybe removed later)

This fix fixes #1557

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2018-02-23 12:10:34 -08:00
committed by Miek Gieben
parent 9047bdf3a0
commit 604c0045e7
563 changed files with 107278 additions and 95314 deletions

View File

@@ -68,7 +68,7 @@ func NewEncoder(w io.Writer, opt *EncoderOptions) (enc *Encoder, err error) {
// Write the start control frame.
start := ControlStart
start.SetContentType(opt.ContentType)
err = start.Encode(enc.writer)
err = start.EncodeFlush(enc.writer)
if err != nil {
return
}

View File

@@ -3,7 +3,9 @@ package framestream_test
import (
"bytes"
"net"
"sync"
"testing"
"time"
framestream "github.com/farsightsec/golang-framestream"
)
@@ -132,3 +134,52 @@ func TestOversizeFrame(t *testing.T) {
t.Error("data frame too large, received %v", err)
}
}
func testNew(t *testing.T, bidirectional bool) {
client, server := net.Pipe()
wg := &sync.WaitGroup{}
wg.Add(2)
done := make(chan bool)
go func() {
_, err := framestream.NewDecoder(server,
&framestream.DecoderOptions{
Bidirectional: bidirectional,
})
if err != nil {
t.Fatal(err)
}
wg.Done()
}()
go func() {
_, err := framestream.NewEncoder(client,
&framestream.EncoderOptions{
Bidirectional: bidirectional,
})
if err != nil {
t.Fatal(err)
}
wg.Done()
}()
go func() {
wg.Wait()
close(done)
}()
select {
case <-done:
case <-time.After(1 * time.Second):
t.Fatal("Time's up.")
}
}
func TestNewBidirectional(t *testing.T) {
testNew(t, true)
}
func TestNewUnidirectional(t *testing.T) {
testNew(t, false)
}