mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Handle generated errors in server-webrtc
This commit is contained in:
parent
82e5753bcc
commit
3ec9dd19fa
3 changed files with 57 additions and 22 deletions
|
@ -23,11 +23,14 @@ func (h *httpHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||
case "GET":
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte(`HTTP signaling channel
|
||||
_, err := w.Write([]byte(`HTTP signaling channel
|
||||
|
||||
Send a POST request containing an SDP offer. The response will
|
||||
contain an SDP answer.
|
||||
`))
|
||||
if err != nil {
|
||||
log.Printf("GET request write failed with error: %v", err)
|
||||
}
|
||||
return
|
||||
case "POST":
|
||||
break
|
||||
|
@ -57,7 +60,11 @@ contain an SDP answer.
|
|||
log.Println("answering HTTP POST")
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte(pc.LocalDescription().Serialize()))
|
||||
_, err = w.Write([]byte(pc.LocalDescription().Serialize()))
|
||||
if err != nil {
|
||||
log.Printf("answering HTTP POST write failed with error %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func receiveSignalsHTTP(addr string, config *webrtc.Configuration) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue