Procházet zdrojové kódy

Merge pull request #357 from Shopify/max-tweak

Make MaxRequestSize signed for consistency with MaxResponseSize
Evan Huus před 10 roky
rodič
revize
9647fbdd91
2 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 1 1
      encoder_decoder.go
  2. 1 1
      sarama.go

+ 1 - 1
encoder_decoder.go

@@ -22,7 +22,7 @@ func encode(in encoder) ([]byte, error) {
 		return nil, err
 	}
 
-	if prepEnc.length < 0 || uint32(prepEnc.length) > MaxRequestSize {
+	if prepEnc.length < 0 || prepEnc.length > int(MaxRequestSize) {
 		return nil, PacketEncodingError{fmt.Sprintf("Invalid request size: %d", prepEnc.length)}
 	}
 

+ 1 - 1
sarama.go

@@ -37,7 +37,7 @@ var PanicHandler func(interface{})
 // to send a request larger than this will result in an PacketEncodingError. The default of 100 MiB is aligned
 // with Kafka's default `socket.request.max.bytes`, which is the largest request the broker will attempt
 // to process.
-var MaxRequestSize uint32 = 100 * 1024 * 1024
+var MaxRequestSize int32 = 100 * 1024 * 1024
 
 // MaxResponseSize is the maximum size (in bytes) of any response that Sarama will attempt to parse. If
 // a broker returns a response message larger than this value, Sarama will return a PacketDecodingError. The