minio / minio-cpp

MinIO C++ Client SDK for Amazon S3 Compatible Cloud Storage
https://minio-cpp.min.io/
Apache License 2.0
127 stars 53 forks source link

ListenBucketNotification endless loop #92

Closed Rattenberger closed 1 year ago

Rattenberger commented 1 year ago

In baseclient.cc in function ListenBucketNotification, the data from the notification gets added in every iteration in the while(true) loop, resulting in a endless loop. You get the same notification over and over again. Moving "data += args.datachunk;" outside of the whileloop fixed the problem for me. But im not sure if thats the intended way.

Old req.datafunc = [&func = func, &data = data](http::DataFunctionArgs args) -> bool { while (true) { data += args.datachunk; size_t pos = data.find('\n'); if (pos == std::string::npos) return true; std::string line = data.substr(0, pos);

New req.datafunc = [&func = func, &data = data](http::DataFunctionArgs args) -> bool { data += args.datachunk; while (true) { size_t pos = data.find('\n'); if (pos == std::string::npos) return true; std::string line = data.substr(0, pos);

balamurugana commented 1 year ago

@Rattenberger Yep. It is a bug. Let me send a PR