chore: log when an invalid watch request is received

As protobuf doesn't have required field, user may send an empty
WatchRequest by mistake. Currently, etcd will ignore the invalid request
and keep the stream opening. If we don't reject the invalid request by
closing the stream, it would be better to leave a log there.

This commit also fixes a typo in the comment.

Signed-off-by: spacewander <spacewanderlzx@gmail.com>
This commit is contained in:
spacewander 2022-08-16 11:33:01 +08:00
parent 22cc682606
commit bebefd8b80

View File

@ -346,8 +346,9 @@ func (sws *serverWatchStream) recvLoop() error {
} }
default: default:
// we probably should not shutdown the entire stream when // we probably should not shutdown the entire stream when
// receive an valid command. // receive an invalid command.
// so just do nothing instead. // so just do nothing instead.
sws.lg.Warn("invalid watch request received in gRPC stream")
continue continue
} }
} }