From 44f2bbd5c3300912d9fa948c54c13eac10486cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20S=C5=82omkowski?= Date: Wed, 20 Jan 2016 21:46:49 +0100 Subject: [PATCH] Increase SSL input buffer to handle images. #7 --- include/mumlib/Transport.hpp | 5 ++--- src/Transport.cpp | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/mumlib/Transport.hpp b/include/mumlib/Transport.hpp index 433106f..ccf94a7 100644 --- a/include/mumlib/Transport.hpp +++ b/include/mumlib/Transport.hpp @@ -18,7 +18,7 @@ namespace mumlib { constexpr int MAX_UDP_LENGTH = 1024; - constexpr int MAX_TCP_LENGTH = 2048; + constexpr int MAX_TCP_LENGTH = 129 * 1024; // 128 kB + some reserve using namespace std; using namespace boost::asio; @@ -85,8 +85,7 @@ namespace mumlib { ssl::context sslContext; ssl::stream sslSocket; - uint8_t sslIncomingBuffer[MAX_TCP_LENGTH]; - + uint8_t *sslIncomingBuffer; deadline_timer pingTimer; std::chrono::time_point lastReceivedUdpPacketTimestamp; diff --git a/src/Transport.cpp b/src/Transport.cpp index 9838eeb..f134512 100644 --- a/src/Transport.cpp +++ b/src/Transport.cpp @@ -42,11 +42,14 @@ mumlib::Transport::Transport( pingTimer(ioService, PING_INTERVAL), asyncBufferPool(max(MAX_UDP_LENGTH, MAX_TCP_LENGTH)) { + sslIncomingBuffer = new uint8_t[MAX_TCP_LENGTH]; + pingTimer.async_wait(boost::bind(&Transport::pingTimerTick, this, _1)); } mumlib::Transport::~Transport() { disconnect(); + delete[] sslIncomingBuffer; } void mumlib::Transport::connect(