summaryrefslogtreecommitdiff
path: root/src/monitor-gui.cc
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2017-08-08 22:37:02 +0200
committerJoel Klinghed <the_jk@yahoo.com>2017-08-08 22:37:02 +0200
commitbf4c145602ad18ba399ce023737bfae3e1411185 (patch)
tree58fe5334fc2ab9f46ef66e0de99d9055881c4afa /src/monitor-gui.cc
parent0596211e959401dd07dc7189c4fd4949e7f7540e (diff)
Lower the amount of bytes shown for package/protocol
And add a text to package view when data is truncated
Diffstat (limited to 'src/monitor-gui.cc')
-rw-r--r--src/monitor-gui.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/monitor-gui.cc b/src/monitor-gui.cc
index 3301ada..eb1f34d 100644
--- a/src/monitor-gui.cc
+++ b/src/monitor-gui.cc
@@ -46,7 +46,8 @@
namespace {
-size_t const MAX_DATA_SIZE = 65536;
+// Max amount of bytes rendered in package / protocol dumps
+size_t const MAX_DATA_SIZE = 16383;
std::string const APP_TITLE = "TransparentProxy";
@@ -1020,6 +1021,12 @@ public:
std::unique_ptr<AttributedText> text(AttributedText::create());
HexDump::write(text.get(), HexDump::ADDRESS | HexDump::CHARS,
pkg.data, 0, MAX_DATA_SIZE);
+ if (pkg.data.size() > MAX_DATA_SIZE) {
+ char tmp[100];
+ auto len = snprintf(tmp, sizeof(tmp), "\nAll %lu bytes not shown...",
+ static_cast<unsigned long>(pkg.data.size()));
+ text->append(tmp, len);
+ }
main_->set_package(std::move(text));
has_related_ = pkg.related != PackageList::NONE;