diff --git a/src/SwooleChannelIterator.php b/src/SwooleChannelIterator.php
index 93ee37628fa972b454e5ab963acfd507a617b3a3..c2b40da37c838ecb56e722c15539336fe44c3582 100644
--- a/src/SwooleChannelIterator.php
+++ b/src/SwooleChannelIterator.php
@@ -64,6 +64,8 @@ readonly class SwooleChannelIterator implements IteratorAggregate
              */
             if (SWOOLE_CHANNEL_OK === $this->channel->errCode) {
                 yield new SwooleChannelIteratorChunk($data);
+            } else {
+                break;
             }
         } while (true);
     }