mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Handle generated errors in client
This commit is contained in:
parent
78a37844b2
commit
b26c7a7a73
3 changed files with 28 additions and 14 deletions
|
@ -138,7 +138,8 @@ func (c *WebRTCPeer) Connect() error {
|
|||
}
|
||||
err = c.establishDataChannel()
|
||||
if err != nil {
|
||||
return errors.New("WebRTC: Could not establish DataChannel.")
|
||||
// nolint: golint
|
||||
return errors.New("WebRTC: Could not establish DataChannel")
|
||||
}
|
||||
err = c.exchangeSDP()
|
||||
if err != nil {
|
||||
|
@ -151,7 +152,9 @@ 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()
|
||||
if err := c.pc.Close(); err != nil {
|
||||
log.Printf("c.pc.Close returned error: %v", err)
|
||||
}
|
||||
c.pc = nil
|
||||
}
|
||||
|
||||
|
@ -267,7 +270,9 @@ func (c *WebRTCPeer) establishDataChannel() error {
|
|||
if err != nil {
|
||||
// TODO: Maybe shouldn't actually close.
|
||||
log.Println("Error writing to SOCKS pipe")
|
||||
c.writePipe.CloseWithError(err)
|
||||
if inerr := c.writePipe.CloseWithError(err); inerr != nil {
|
||||
log.Printf("c.writePipe.CloseWithError returned error: %v", inerr)
|
||||
}
|
||||
}
|
||||
if n != len(msg.Data) {
|
||||
log.Println("Error: short write")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue