Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Anti-censorship
Pluggable Transports
Snowflake
Commits
f6301197
Commit
f6301197
authored
Mar 01, 2018
by
Arlo Breault
Browse files
Call explicit frees in client
parent
ee4e0aa1
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/webrtc.go
View file @
f6301197
...
...
@@ -147,7 +147,7 @@ func (c *WebRTCPeer) Connect() error {
// Create and prepare callbacks on a new WebRTC PeerConnection.
func
(
c
*
WebRTCPeer
)
preparePeerConnection
()
error
{
if
nil
!=
c
.
pc
{
c
.
pc
.
Close
()
c
.
pc
.
Destroy
()
c
.
pc
=
nil
}
pc
,
err
:=
webrtc
.
NewPeerConnection
(
c
.
config
)
...
...
@@ -230,6 +230,7 @@ func (c *WebRTCPeer) establishDataChannel() error {
// Disable the DataChannel as a write destination.
log
.
Println
(
"WebRTC: DataChannel.OnClose [remotely]"
)
c
.
transport
=
nil
c
.
pc
.
DeleteDataChannel
(
dc
)
c
.
Close
()
}
dc
.
OnMessage
=
func
(
msg
[]
byte
)
{
...
...
@@ -326,11 +327,14 @@ func (c *WebRTCPeer) cleanup() {
// Setting transport to nil *before* dc Close indicates to OnClose that
// this was locally triggered.
c
.
transport
=
nil
dataChannel
.
Close
()
if
c
.
pc
==
nil
{
panic
(
"DataChannel w/o PeerConnection, not good."
)
}
c
.
pc
.
DeleteDataChannel
(
dataChannel
.
(
*
webrtc
.
DataChannel
))
}
if
nil
!=
c
.
pc
{
log
.
Printf
(
"WebRTC: closing PeerConnection"
)
err
:=
c
.
pc
.
Close
()
err
:=
c
.
pc
.
Destroy
()
if
nil
!=
err
{
log
.
Printf
(
"Error closing peerconnection..."
)
}
...
...
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