[tor-commits] [snowflake/master] Return after bad request

arlo at torproject.org arlo at torproject.org
Wed May 11 14:27:59 UTC 2016


commit bdbabe5e0c0cdc651a8c23262759074625d9d554
Author: Arlo Breault <arlolra at gmail.com>
Date:   Wed May 11 07:27:42 2016 -0700

    Return after bad request
---
 broker/broker.go | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/broker/broker.go b/broker/broker.go
index ffeabdd..3c50ac9 100644
--- a/broker/broker.go
+++ b/broker/broker.go
@@ -118,8 +118,10 @@ func proxyPolls(ctx *BrokerContext, w http.ResponseWriter, r *http.Request) {
 		w.WriteHeader(http.StatusBadRequest)
 		return
 	}
-	if string(body) != id { // Mismatched IDs!
+	if string(body) != id {
+		log.Println("Mismatched IDs!")
 		w.WriteHeader(http.StatusBadRequest)
+		return
 	}
 	log.Println("Received snowflake: ", id)
 	// Wait for a client to avail an offer to the snowflake, or timeout if nil.
@@ -162,7 +164,6 @@ func clientOffers(ctx *BrokerContext, w http.ResponseWriter, r *http.Request) {
 	case answer := <-snowflake.answerChannel:
 		log.Println("Client: Retrieving answer")
 		w.Write(answer)
-
 	case <-time.After(time.Second * ClientTimeout):
 		log.Println("Client: Timed out.")
 		w.WriteHeader(http.StatusGatewayTimeout)



More information about the tor-commits mailing list