mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -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
|
@ -56,18 +56,18 @@ func Handler(socks SocksConnector, snowflakes SnowflakeCollector) error {
|
|||
|
||||
// Exchanges bytes between two ReadWriters.
|
||||
// (In this case, between a SOCKS and WebRTC connection.)
|
||||
func copyLoop(a, b io.ReadWriter) {
|
||||
func copyLoop(WebRTC, SOCKS io.ReadWriter) {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
go func() {
|
||||
if _, err := io.Copy(ORPort, WebRTC); err != nil {
|
||||
log.Printf("copying WebRTC to ORPort resulted in error: %v", err)
|
||||
if _, err := io.Copy(SOCKS, WebRTC); err != nil {
|
||||
log.Printf("copying WebRTC to SOCKS resulted in error: %v", err)
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
go func() {
|
||||
if _, err := io.Copy(WebRTC, ORPort); err != nil {
|
||||
log.Printf("copying ORPort to WebRTC resulted in error: %v", err)
|
||||
if _, err := io.Copy(WebRTC, SOCKS); err != nil {
|
||||
log.Printf("copying SOCKS to WebRTC resulted in error: %v", err)
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue