Explorar o código

Fix metadata requests on later versions

If the set of Topics is an empty array, we don't need to put it in the
request or we'll just get an empty set of data back which is useless.
As far as I can tell the nil check was for safety, but len(nil) is
already safe and the boolean logic was wrong anyway.
Evan Huus %!s(int64=6) %!d(string=hai) anos
pai
achega
46821574be
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      metadata_request.go

+ 1 - 1
metadata_request.go

@@ -10,7 +10,7 @@ func (r *MetadataRequest) encode(pe packetEncoder) error {
 	if r.Version < 0 || r.Version > 5 {
 		return PacketEncodingError{"invalid or unsupported MetadataRequest version field"}
 	}
-	if r.Version == 0 || r.Topics != nil || len(r.Topics) > 0 {
+	if r.Version == 0 || len(r.Topics) > 0 {
 		err := pe.putArrayLength(len(r.Topics))
 		if err != nil {
 			return err