From: Roland Häder <roland@mxchange.org>
Date: Sat, 4 Aug 2012 23:13:14 +0000 (+0000)
Subject: Handle AssertionException and copy the raw data (do not decode partial data)
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3c59603bc3a1365de3ad1634a80b231b27b4a033;p=hub.git

Handle AssertionException and copy the raw data (do not decode partial data)
---

diff --git a/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php b/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php
index 5ffe49ca2..12e9a351d 100644
--- a/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php
+++ b/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php
@@ -107,7 +107,16 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable {
 			 * Low-level checks of the raw data went all fine, now decode the
 			 * raw data. This may still fail because of invalid encoded data.
 			 */
-			$decodedData = $this->getInputStreamInstance()->streamData($rawData);
+			try {
+				$decodedData = $this->getInputStreamInstance()->streamData($rawData);
+			} catch (AssertionException $e) {
+				/*
+				 * This may happen with a multi-chunk stream (more data sent
+				 * than output/input buffers can handle) so the raw data needs
+				 * to be handled somewhere else.
+				 */
+				$decodedData = $rawData;
+			}
 		}
 
 		// Add the (maybe above decoded) data to the stacker