mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Have util.{Serialize,Deserialize}SessionDescription return an error
https://bugs.torproject.org/33897#comment:4
This commit is contained in:
parent
76732155e7
commit
b48fb781ee
3 changed files with 26 additions and 27 deletions
|
@ -96,7 +96,11 @@ func (bc *BrokerChannel) Negotiate(offer *webrtc.SessionDescription) (
|
|||
SDP: util.StripLocalAddresses(offer.SDP),
|
||||
}
|
||||
}
|
||||
data := bytes.NewReader([]byte(util.SerializeSessionDescription(offer)))
|
||||
offerSDP, err := util.SerializeSessionDescription(offer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
data := bytes.NewReader([]byte(offerSDP))
|
||||
// Suffix with broker's client registration handler.
|
||||
clientURL := bc.url.ResolveReference(&url.URL{Path: "client"})
|
||||
request, err := http.NewRequest("POST", clientURL.String(), data)
|
||||
|
@ -119,8 +123,7 @@ func (bc *BrokerChannel) Negotiate(offer *webrtc.SessionDescription) (
|
|||
if nil != err {
|
||||
return nil, err
|
||||
}
|
||||
answer := util.DeserializeSessionDescription(string(body))
|
||||
return answer, nil
|
||||
return util.DeserializeSessionDescription(string(body))
|
||||
case http.StatusServiceUnavailable:
|
||||
return nil, errors.New(BrokerError503)
|
||||
case http.StatusBadRequest:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue