commit 461dbeba80ad43f043d39cddae7e9d0e38fc3dd4
Author: David Fifield <[email protected]>
Date:   Tue Aug 1 15:06:53 2017 -0700

    Make capacity a uint.
    
    This prohibits some nonsense like "./proxy-go -capacity -550", which
    otherwise results in a panic like:
    
    INFO: configuration.go:174: Created Configuration at  
&{[{[stun:stun.l.google.com:19302]  }] All Balanced }
    panic: makechan: size out of range
---
 proxy-go/snowflake.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxy-go/snowflake.go b/proxy-go/snowflake.go
index 26e7994..5111e8e 100644
--- a/proxy-go/snowflake.go
+++ b/proxy-go/snowflake.go
@@ -26,7 +26,7 @@ const defaultRelayURL = "wss://snowflake.bamsoftware.com/"
 const defaultSTUNURL = "stun:stun.l.google.com:19302"
 
 type snowflakeOptions struct {
-       capacity  int
+       capacity  uint
        broker    string
        brokerURL *url.URL
        stun      string
@@ -296,7 +296,7 @@ func runSession(sid string) {
 func main() {
        var logFilename string
        opt = new(snowflakeOptions)
-       flag.IntVar(&opt.capacity, "capacity", 10, "maximum concurrent clients")
+       flag.UintVar(&opt.capacity, "capacity", 10, "maximum concurrent 
clients")
        flag.StringVar(&opt.broker, "broker", defaultBrokerURL, "broker URL")
        flag.StringVar(&opt.relay, "relay", defaultRelayURL, "websocket relay 
URL")
        flag.StringVar(&opt.stun, "stun", defaultSTUNURL, "stun URL")
@@ -329,7 +329,7 @@ func main() {
 
        config = webrtc.NewConfiguration(webrtc.OptionIceServer(opt.stun))
        tokens = make(chan bool, opt.capacity)
-       for i := 0; i < opt.capacity; i++ {
+       for i := uint(0); i < opt.capacity; i++ {
                tokens <- true
        }
 



_______________________________________________
tor-commits mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to