Skip to content

Commit

Permalink
Merge pull request #1 from pion/master
Browse files Browse the repository at this point in the history
bug fix
  • Loading branch information
hcm007 committed Sep 9, 2019
2 parents 59f78ad + 29c7cda commit dd130c0
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 17 deletions.
12 changes: 9 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
language: c

branches:
only:
- master

cache:
directories:
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod

env:
- GO111MODULE=on

Expand All @@ -12,15 +18,15 @@ services:
install:
# Manually download and install Go 1.12 instead of using gimme.
# It looks like gimme Go causes some errors on go-test for Wasm.
- wget -O go.tar.gz https://dl.google.com/go/go1.12.linux-amd64.tar.gz
- wget -O go.tar.gz https://dl.google.com/go/go1.13.linux-amd64.tar.gz
- tar -C ~ -xzf go.tar.gz
- rm go.tar.gz
- export GOROOT=~/go
- export PATH=$GOROOT/bin:$PATH
- go version
- go env
- go get -u github.com/matoous/godox
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.17.1
- GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
# Install Node 11 (required for WASM tests)
- wget https://raw.githubusercontent.com/creationix/nvm/v0.31.0/nvm.sh -O ~/.nvm/nvm.sh
- source ~/.nvm/nvm.sh
Expand All @@ -42,4 +48,4 @@ script:
- go test -tags quic -coverpkg=$(go list ./... | grep -v examples | tr '\n' ',') -coverprofile=cover.out -v -race -covermode=atomic ./...
- GOOS=js GOARCH=wasm go test -exec="./test-wasm/go_js_wasm_exec" -v .
- bash <(curl -s https://codecov.io/bash)
- docker run -e "GO111MODULE=on" -v $PWD:/go/src/github.com/pion/webrtc -w /go/src/github.com/pion/webrtc -it i386/golang:1.12-buster '/usr/local/go/bin/go' 'test' '-tags' 'quic' "-coverpkg=$(go list ./... | grep -v examples | tr '\n' ',')" '-v' './...'
- docker run -e "GO111MODULE=on" -v $PWD:/go/src/github.com/pion/webrtc -w /go/src/github.com/pion/webrtc -it i386/golang:1.13-buster '/usr/local/go/bin/go' 'test' '-tags' 'quic' "-coverpkg=$(go list ./... | grep -v examples | tr '\n' ',')" '-v' './...'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu
* [Gareth Hayes](https://github.com/gazhayes)
* [Sebastian Waisbrot](https://github.com/seppo0010)
* [Masataka Hisasue](https://github.com/sylba2050) - *Fix Docs*
* [Hongchao Ma(马洪超)](https://github.com/hcm007)

### License
MIT License - see [LICENSE](LICENSE) for full text
6 changes: 3 additions & 3 deletions datachannel_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ func (d *DataChannel) Send(data []byte) (err error) {
err = recoveryToError(e)
}
}()
array := js.TypedArrayOf([]uint8(data))
defer array.Release()
d.underlying.Call("send", array.Value)
array := js.Global().Get("Uint8Array").New(len(data))
js.CopyBytesToJS(array, data)
d.underlying.Call("send", array)
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ module github.com/pion/webrtc/v2
go 1.12

require (
github.com/pion/datachannel v1.4.5
github.com/pion/datachannel v1.4.6
github.com/pion/dtls v1.5.1
github.com/pion/ice v0.5.14
github.com/pion/logging v0.2.2
github.com/pion/quic v0.1.1
github.com/pion/rtcp v1.2.1
github.com/pion/rtp v1.1.3
github.com/pion/sctp v1.6.9
github.com/pion/sctp v1.6.10
github.com/pion/sdp/v2 v2.3.0
github.com/pion/srtp v1.2.6
github.com/pion/transport v0.8.6
github.com/pion/transport v0.8.7
github.com/stretchr/testify v1.4.0
)
18 changes: 13 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lucas-clemente/quic-go v0.7.1-0.20190401152353-907071221cf9 h1:tbuodUh2vuhOVZAdW3NEUvosFHUMJwUNl7jk/VSEiwc=
github.com/lucas-clemente/quic-go v0.7.1-0.20190401152353-907071221cf9/go.mod h1:PpMmPfPKO9nKJ/psF49ESTAGQSdfXxlg1otPbEB2nOw=
github.com/marten-seemann/qtls v0.2.3 h1:0yWJ43C62LsZt08vuQJDK1uC1czUc3FJeCLPoNAI4vA=
Expand All @@ -20,8 +25,8 @@ github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pion/datachannel v1.4.5 h1:paz18kYAetpTdK8tlMAtDY+Ayxrv5fndZ5XPZwiZHrU=
github.com/pion/datachannel v1.4.5/go.mod h1:SpMJbuu8v+qbA94m6lWQwSdCf8JKQvgmdSHDNtcbe+w=
github.com/pion/datachannel v1.4.6 h1:ALIwApJIxXOxA142PwJ7abvHwVdicVMqjkQNZC1WxLU=
github.com/pion/datachannel v1.4.6/go.mod h1:k02QlG7ZByXzavnjWj3gP3W1474H4ifzxSx2Y0Q5kvc=
github.com/pion/dtls v1.5.1 h1:LcCs1l9fzsHC4y+ENjLyuxOAe+k0DV65T2n4tjwM7xw=
github.com/pion/dtls v1.5.1/go.mod h1:CjlPLfQdsTg3G4AEXjJp8FY5bRweBlxHrgoFrN+fQsk=
github.com/pion/ice v0.5.14 h1:52U/careKfOIueU+tC2fTbI+1amf3EHe1W6ter70M0w=
Expand All @@ -37,9 +42,8 @@ github.com/pion/rtcp v1.2.1 h1:S3yG4KpYAiSmBVqKAfgRa5JdwBNj4zK3RLUa8JYdhak=
github.com/pion/rtcp v1.2.1/go.mod h1:a5dj2d6BKIKHl43EnAOIrCczcjESrtPuMgfmL6/K6QM=
github.com/pion/rtp v1.1.3 h1:GTYSTsSLF5vH+UqShGYQEBdoYasWjTTC9UeYglnUO+o=
github.com/pion/rtp v1.1.3/go.mod h1:/l4cvcKd0D3u9JLs2xSVI95YkfXW87a3br3nqmVtSlE=
github.com/pion/sctp v1.6.3/go.mod h1:cCqpLdYvgEUdl715+qbWtgT439CuQrAgy8BZTp0aEfA=
github.com/pion/sctp v1.6.9 h1:G5Ttf/z5klWaCpE4jnqKWvbOuwfL3vBLyRdiFdtBIYQ=
github.com/pion/sctp v1.6.9/go.mod h1:cCqpLdYvgEUdl715+qbWtgT439CuQrAgy8BZTp0aEfA=
github.com/pion/sctp v1.6.10 h1:7odhpD08TTc84a/OXwMAFEtOKka+HkD//Ze+sD8qcxU=
github.com/pion/sctp v1.6.10/go.mod h1:cCqpLdYvgEUdl715+qbWtgT439CuQrAgy8BZTp0aEfA=
github.com/pion/sdp/v2 v2.3.0 h1:5EhwPh1xKWYYjjvMuubHoMLy6M0B9U26Hh7q3f7vEGk=
github.com/pion/sdp/v2 v2.3.0/go.mod h1:idSlWxhfWQDtTy9J05cgxpHBu/POwXN2VDRGYxT/EjU=
github.com/pion/srtp v1.2.6 h1:mHQuAMh0P67R7/j1F260u3O+fbRWLyjKLRPZYYvODFM=
Expand All @@ -50,6 +54,8 @@ github.com/pion/transport v0.6.0/go.mod h1:iWZ07doqOosSLMhZ+FXUTq+TamDoXSllxpbGc
github.com/pion/transport v0.7.0/go.mod h1:iWZ07doqOosSLMhZ+FXUTq+TamDoXSllxpbGcfkCmbE=
github.com/pion/transport v0.8.6 h1:xHQq2mxAjB+UrFs90aUBaXwlmIACfQAZnOiVAX3uqMw=
github.com/pion/transport v0.8.6/go.mod h1:nAmRRnn+ArVtsoNuwktvAD+jrjSD7pA+H3iRmZwdUno=
github.com/pion/transport v0.8.7 h1:t7uYhWOoljd82rnkLH+H2Lw7/IGA5kV9Bl5sWrmcYSc=
github.com/pion/transport v0.8.7/go.mod h1:lpeSM6KJFejVtZf8k0fgeN7zE73APQpTF83WvA1FVP8=
github.com/pion/turn v1.3.5 h1:4JrsJHS/qm29bpzqem+WN87A+xCNAwj0i5DxuKqicTw=
github.com/pion/turn v1.3.5/go.mod h1:zGPB7YYB/HTE9MWn0Sbznz8NtyfeVeanZ834cG/MXu0=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down Expand Up @@ -83,6 +89,8 @@ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
Expand Down
6 changes: 5 additions & 1 deletion internal/mux/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ func (m *Mux) dispatch(buf []byte) error {
m.lock.Unlock()

if endpoint == nil {
m.log.Warnf("Warning: mux: no endpoint for packet starting with %d\n", buf[0])
if len(buf) > 0 {
m.log.Warnf("Warning: mux: no endpoint for packet starting with %d\n", buf[0])
} else {
m.log.Warnf("Warning: mux: no endpoint for zero length packet")
}
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions js_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func recoveryToError(e interface{}) error {

func uint8ArrayValueToBytes(val js.Value) []byte {
result := make([]byte, val.Length())
jsResult := js.TypedArrayOf(result)
jsResult.Call("set", val)
js.CopyBytesToGo(result, val)

return result
}

0 comments on commit dd130c0

Please sign in to comment.