imports/inspections

This commit is contained in:
David Colburn
2021-06-04 14:30:10 -05:00
parent c510ea2e1a
commit 5baf97e99b
7 changed files with 19 additions and 23 deletions
+2 -2
View File
@@ -4,9 +4,10 @@ import (
"sync" "sync"
"time" "time"
"github.com/livekit/protocol/utils"
"github.com/livekit/livekit-server/pkg/logger" "github.com/livekit/livekit-server/pkg/logger"
livekit "github.com/livekit/livekit-server/proto" livekit "github.com/livekit/livekit-server/proto"
"github.com/livekit/protocol/utils"
) )
// a router of messages on the same node, basic implementation for local testing // a router of messages on the same node, basic implementation for local testing
@@ -121,7 +122,6 @@ func (r *LocalRouter) Start() error {
} }
func (r *LocalRouter) Stop() { func (r *LocalRouter) Stop() {
r.rtcMessageChan.Close() r.rtcMessageChan.Close()
} }
+2 -2
View File
@@ -361,7 +361,7 @@ func (r *RedisRouter) handleSignalMessage(sm *livekit.SignalNodeMessage) error {
switch rmb := sm.Message.(type) { switch rmb := sm.Message.(type) {
case *livekit.SignalNodeMessage_Response: case *livekit.SignalNodeMessage_Response:
//logger.Debugw("forwarding signal message", // logger.Debugw("forwarding signal message",
// "connectionId", connectionId, // "connectionId", connectionId,
// "type", fmt.Sprintf("%T", rmb.Response.Message)) // "type", fmt.Sprintf("%T", rmb.Response.Message))
if err := resSink.WriteMessage(rmb.Response); err != nil { if err := resSink.WriteMessage(rmb.Response); err != nil {
@@ -369,7 +369,7 @@ func (r *RedisRouter) handleSignalMessage(sm *livekit.SignalNodeMessage) error {
} }
case *livekit.SignalNodeMessage_EndSession: case *livekit.SignalNodeMessage_EndSession:
//logger.Debugw("received EndSession, closing signal connection", // logger.Debugw("received EndSession, closing signal connection",
// "connectionId", connectionId) // "connectionId", connectionId)
resSink.Close() resSink.Close()
} }
+2 -3
View File
@@ -32,7 +32,7 @@ type DataTrack struct {
func NewDataTrack(trackId, participantId string, dc *webrtc.DataChannel) *DataTrack { func NewDataTrack(trackId, participantId string, dc *webrtc.DataChannel) *DataTrack {
t := &DataTrack{ t := &DataTrack{
//ctx: context.Background(), // ctx: context.Background(),
id: trackId, id: trackId,
name: dc.Label(), name: dc.Label(),
participantId: participantId, participantId: participantId,
@@ -156,8 +156,7 @@ func (t *DataTrack) forwardWorker() {
for _, sub := range t.subscribers { for _, sub := range t.subscribers {
err := sub.SendMessage(msg) err := sub.SendMessage(msg)
if err != nil { if err != nil {
logger.Errorw("could not send data message", logger.Errorw("could not send data message", err,
err,
"source", t.participantId, "source", t.participantId,
"dest", sub.participantId) "dest", sub.participantId)
} }
+3 -3
View File
@@ -841,7 +841,7 @@ func (p *ParticipantImpl) handleTrackPublished(track types.PublishedTrack) {
} }
func (p *ParticipantImpl) handlePublisherICEStateChange(state webrtc.ICEConnectionState) { func (p *ParticipantImpl) handlePublisherICEStateChange(state webrtc.ICEConnectionState) {
//logger.Debugw("ICE connection state changed", "state", state.String(), // logger.Debugw("ICE connection state changed", "state", state.String(),
// "participant", p.identity) // "participant", p.identity)
if state == webrtc.ICEConnectionStateConnected { if state == webrtc.ICEConnectionStateConnected {
p.updateState(livekit.ParticipantInfo_ACTIVE) p.updateState(livekit.ParticipantInfo_ACTIVE)
@@ -924,9 +924,9 @@ func (p *ParticipantImpl) rtcpSendWorker() {
if pkts == nil { if pkts == nil {
return return
} }
//for _, pkt := range pkts { // for _, pkt := range pkts {
// logger.Debugw("writing RTCP", "packet", pkt) // logger.Debugw("writing RTCP", "packet", pkt)
//} // }
if err := p.publisher.pc.WriteRTCP(pkts); err != nil { if err := p.publisher.pc.WriteRTCP(pkts); err != nil {
logger.Errorw("could not write RTCP to participant", err, logger.Errorw("could not write RTCP to participant", err,
"participant", p.Identity()) "participant", p.Identity())
+2 -2
View File
@@ -370,7 +370,7 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.Partici
case *livekit.SignalRequest_Answer: case *livekit.SignalRequest_Answer:
if participant.State() == livekit.ParticipantInfo_JOINING { if participant.State() == livekit.ParticipantInfo_JOINING {
logger.Errorw("cannot negotiate before peer offer", nil, "participant", participant.Identity()) logger.Errorw("cannot negotiate before peer offer", nil, "participant", participant.Identity())
//conn.WriteJSON(jsonError(http.StatusNotAcceptable, "cannot negotiate before peer offer")) // conn.WriteJSON(jsonError(http.StatusNotAcceptable, "cannot negotiate before peer offer"))
return return
} }
sd := rtc.FromProtoSessionDescription(msg.Answer) sd := rtc.FromProtoSessionDescription(msg.Answer)
@@ -383,7 +383,7 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.Partici
logger.Errorw("could not decode trickle", err, "participant", participant.Identity()) logger.Errorw("could not decode trickle", err, "participant", participant.Identity())
break break
} }
//logger.Debugw("adding peer candidate", "participant", participant.ID()) // logger.Debugw("adding peer candidate", "participant", participant.ID())
if err := participant.AddICECandidate(candidateInit, msg.Trickle.Target); err != nil { if err := participant.AddICECandidate(candidateInit, msg.Trickle.Target); err != nil {
logger.Errorw("could not handle trickle", err, "participant", participant.Identity()) logger.Errorw("could not handle trickle", err, "participant", participant.Identity())
} }
+1 -1
View File
@@ -1,6 +1,6 @@
// Code generated by Wire. DO NOT EDIT. // Code generated by Wire. DO NOT EDIT.
//go:generate wire //go:generate go run github.com/google/wire/cmd/wire
//+build !wireinject //+build !wireinject
package service package service
+7 -10
View File
@@ -9,17 +9,17 @@ import (
"time" "time"
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
"github.com/livekit/livekit-server/pkg/testutils" "github.com/livekit/protocol/auth"
testclient "github.com/livekit/livekit-server/test/client" "github.com/livekit/protocol/utils"
"github.com/twitchtv/twirp" "github.com/twitchtv/twirp"
"github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/logger" "github.com/livekit/livekit-server/pkg/logger"
"github.com/livekit/livekit-server/pkg/routing" "github.com/livekit/livekit-server/pkg/routing"
"github.com/livekit/livekit-server/pkg/service" "github.com/livekit/livekit-server/pkg/service"
"github.com/livekit/livekit-server/pkg/testutils"
livekit "github.com/livekit/livekit-server/proto" livekit "github.com/livekit/livekit-server/proto"
"github.com/livekit/protocol/auth" testclient "github.com/livekit/livekit-server/test/client"
"github.com/livekit/protocol/utils"
) )
const ( const (
@@ -34,7 +34,7 @@ const (
syncDelay = 100 * time.Millisecond syncDelay = 100 * time.Millisecond
// if there are deadlocks, it's helpful to set a short test timeout (i.e. go test -timeout=30s) // if there are deadlocks, it's helpful to set a short test timeout (i.e. go test -timeout=30s)
// let connection timeout happen // let connection timeout happen
//connectTimeout = 5000 * time.Second // connectTimeout = 5000 * time.Second
) )
var ( var (
@@ -112,7 +112,6 @@ func waitForServerToStart(s *service.LivekitServer) {
func waitUntilConnected(t *testing.T, clients ...*testclient.RTCClient) { func waitUntilConnected(t *testing.T, clients ...*testclient.RTCClient) {
logger.Infow("waiting for clients to become connected") logger.Infow("waiting for clients to become connected")
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
errChan := make(chan error, len(clients))
for i := range clients { for i := range clients {
c := clients[i] c := clients[i]
wg.Add(1) wg.Add(1)
@@ -120,15 +119,13 @@ func waitUntilConnected(t *testing.T, clients ...*testclient.RTCClient) {
defer wg.Done() defer wg.Done()
err := c.WaitUntilConnected() err := c.WaitUntilConnected()
if err != nil { if err != nil {
errChan <- err
t.Error(err) t.Error(err)
} }
}() }()
} }
wg.Wait() wg.Wait()
close(errChan) if t.Failed() {
for err := range errChan { t.FailNow()
t.Fatal(err)
} }
} }