Increase SSL input buffer to handle images. #7

This commit is contained in:
Michał Słomkowski 2016-01-20 21:46:49 +01:00
parent 2617016706
commit 44f2bbd5c3
2 changed files with 5 additions and 3 deletions

View File

@ -18,7 +18,7 @@
namespace mumlib { namespace mumlib {
constexpr int MAX_UDP_LENGTH = 1024; 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 std;
using namespace boost::asio; using namespace boost::asio;
@ -85,8 +85,7 @@ namespace mumlib {
ssl::context sslContext; ssl::context sslContext;
ssl::stream<tcp::socket> sslSocket; ssl::stream<tcp::socket> sslSocket;
uint8_t sslIncomingBuffer[MAX_TCP_LENGTH]; uint8_t *sslIncomingBuffer;
deadline_timer pingTimer; deadline_timer pingTimer;
std::chrono::time_point<std::chrono::system_clock> lastReceivedUdpPacketTimestamp; std::chrono::time_point<std::chrono::system_clock> lastReceivedUdpPacketTimestamp;

View File

@ -42,11 +42,14 @@ mumlib::Transport::Transport(
pingTimer(ioService, PING_INTERVAL), pingTimer(ioService, PING_INTERVAL),
asyncBufferPool(max(MAX_UDP_LENGTH, MAX_TCP_LENGTH)) { asyncBufferPool(max(MAX_UDP_LENGTH, MAX_TCP_LENGTH)) {
sslIncomingBuffer = new uint8_t[MAX_TCP_LENGTH];
pingTimer.async_wait(boost::bind(&Transport::pingTimerTick, this, _1)); pingTimer.async_wait(boost::bind(&Transport::pingTimerTick, this, _1));
} }
mumlib::Transport::~Transport() { mumlib::Transport::~Transport() {
disconnect(); disconnect();
delete[] sslIncomingBuffer;
} }
void mumlib::Transport::connect( void mumlib::Transport::connect(