[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit bdbabe5e0c0cdc651a8c23262759074625d9d554
Author: Arlo Breault <arlolra@xxxxxxxxx>
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)

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits