From 710be47e1d69788a858defb02295beddab19168e Mon Sep 17 00:00:00 2001
From: SirCipher <tklapwijk92@gmail.com>
Date: Wed, 23 Sep 2020 17:09:09 +0100
Subject: [PATCH] Changes chunk iterator to use field for chunk size

---
 src/protocol/mod.rs | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs
index 17d1d9c..9af32c7 100644
--- a/src/protocol/mod.rs
+++ b/src/protocol/mod.rs
@@ -611,10 +611,7 @@ where
 
         let max_frame_size = self.config.max_frame_size.unwrap_or_else(usize::max_value);
         if frame.payload().len() > max_frame_size {
-            let mut chunks = frame
-                .payload()
-                .chunks(self.config.max_frame_size.unwrap_or_else(usize::max_value))
-                .peekable();
+            let mut chunks = frame.payload().chunks(max_frame_size).peekable();
             let data_frame = Frame::message(
                 Vec::from(chunks.next().unwrap()),
                 frame.header().opcode,