Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sfu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alain Takoudjou
sfu
Commits
37b19940
Commit
37b19940
authored
May 30, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fail addLocal if connection is closed.
parent
7972edfc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
18 deletions
+41
-18
conn.go
conn.go
+30
-7
disk.go
disk.go
+4
-1
webclient.go
webclient.go
+7
-10
No files found.
conn.go
View file @
37b19940
...
...
@@ -50,17 +50,19 @@ func (up *upTrack) notifyLocal(add bool, track downTrack) {
}
}
func
(
up
*
upTrack
)
addLocal
(
local
downTrack
)
{
func
(
up
*
upTrack
)
addLocal
(
local
downTrack
)
error
{
up
.
mu
.
Lock
()
for
_
,
t
:=
range
up
.
local
{
if
t
==
local
{
up
.
mu
.
Unlock
()
return
return
nil
}
}
up
.
local
=
append
(
up
.
local
,
local
)
up
.
mu
.
Unlock
()
up
.
notifyLocal
(
true
,
local
)
return
nil
}
func
(
up
*
upTrack
)
delLocal
(
local
downTrack
)
bool
{
...
...
@@ -107,20 +109,26 @@ type upConnection struct {
labels
map
[
string
]
string
iceCandidates
[]
*
webrtc
.
ICECandidateInit
mu
sync
.
Mutex
local
[]
downConnection
mu
sync
.
Mutex
closed
bool
local
[]
downConnection
}
func
(
up
*
upConnection
)
addLocal
(
local
downConnection
)
{
var
ErrConnectionClosed
=
errors
.
New
(
"connection is closed"
)
func
(
up
*
upConnection
)
addLocal
(
local
downConnection
)
error
{
up
.
mu
.
Lock
()
defer
up
.
mu
.
Unlock
()
if
up
.
closed
{
return
ErrConnectionClosed
}
for
_
,
t
:=
range
up
.
local
{
if
t
==
local
{
up
.
mu
.
Unlock
()
return
return
nil
}
}
up
.
local
=
append
(
up
.
local
,
local
)
return
nil
}
func
(
up
*
upConnection
)
delLocal
(
local
downConnection
)
bool
{
...
...
@@ -143,6 +151,21 @@ func (up *upConnection) getLocal() []downConnection {
return
local
}
func
(
up
*
upConnection
)
Close
()
error
{
up
.
mu
.
Lock
()
defer
up
.
mu
.
Unlock
()
go
func
(
local
[]
downConnection
)
{
for
_
,
l
:=
range
local
{
l
.
Close
()
}
}(
up
.
local
)
up
.
local
=
nil
up
.
closed
=
true
return
up
.
pc
.
Close
()
}
func
(
up
*
upConnection
)
addICECandidate
(
candidate
*
webrtc
.
ICECandidateInit
)
error
{
if
up
.
pc
.
RemoteDescription
()
!=
nil
{
return
up
.
pc
.
AddICECandidate
(
*
candidate
)
...
...
disk.go
View file @
37b19940
...
...
@@ -194,7 +194,10 @@ func newDiskConn(directory, label string, up *upConnection, remoteTracks []*upTr
}
}
up
.
addLocal
(
&
conn
)
err
:=
up
.
addLocal
(
&
conn
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
conn
,
nil
}
...
...
webclient.go
View file @
37b19940
...
...
@@ -675,14 +675,7 @@ func delUpConn(c *webClient, id string) bool {
}
}
local
:=
conn
.
getLocal
()
go
func
()
{
for
_
,
l
:=
range
local
{
l
.
Close
()
}
}()
conn
.
pc
.
Close
()
conn
.
Close
()
delete
(
c
.
up
,
id
)
return
true
}
...
...
@@ -744,9 +737,13 @@ func addDownConn(c *webClient, id string, remote *upConnection) (*rtpDownConnect
conn
.
pc
.
Close
()
return
nil
,
errors
.
New
(
"Adding duplicate connection"
)
}
c
.
down
[
id
]
=
conn
err
=
remote
.
addLocal
(
conn
)
if
err
!=
nil
{
conn
.
pc
.
Close
()
return
nil
,
err
}
remote
.
addLocal
(
conn
)
c
.
down
[
id
]
=
conn
return
conn
,
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment