Optimized size of CallContext buffer sizes
This commit is contained in:
parent
953a5d0f63
commit
52e3bec656
|
|
@ -33,7 +33,7 @@
|
||||||
#include <sodium.h>
|
#include <sodium.h>
|
||||||
|
|
||||||
CallContext::CallContext()
|
CallContext::CallContext()
|
||||||
: stringBuffer(1024, "CallContext stringBuffer")
|
: stringBuffer(MINIMUM_STRING_BUFFER_SIZE, "CallContext stringBuffer")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,7 +48,6 @@ void CallContext::printf(const char* format, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* CallContext::reserveStringBuffer(int stringLength)
|
char* CallContext::reserveStringBuffer(int stringLength)
|
||||||
{
|
{
|
||||||
int requiredNewBufferLength = stringLength + 1; // reserve buffer for characters and string terminator '\0'
|
int requiredNewBufferLength = stringLength + 1; // reserve buffer for characters and string terminator '\0'
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ struct HAPClient;
|
||||||
|
|
||||||
class CallContext
|
class CallContext
|
||||||
{
|
{
|
||||||
|
static const int MINIMUM_STRING_BUFFER_SIZE=1006; // Same as framesize for SendEncryptedCallContext
|
||||||
private:
|
private:
|
||||||
TempBuffer<char> stringBuffer;
|
TempBuffer<char> stringBuffer;
|
||||||
int usedStringLength = 0;
|
int usedStringLength = 0;
|
||||||
|
|
@ -55,7 +56,7 @@ protected:
|
||||||
|
|
||||||
class SendEncryptedCallContext : public CallContext
|
class SendEncryptedCallContext : public CallContext
|
||||||
{
|
{
|
||||||
static const int FRAME_SIZE=1024; // number of bytes to use in each ChaCha20-Poly1305 encrypted frame when sending encrypted JSON content to Client
|
static const int FRAME_SIZE=1006; // 1024 - AAD - Auth // number of bytes to use in each ChaCha20-Poly1305 encrypted frame when sending encrypted JSON content to Client
|
||||||
|
|
||||||
HAPClient& hapClient;
|
HAPClient& hapClient;
|
||||||
TempBuffer<uint8_t> sendBuffer;
|
TempBuffer<uint8_t> sendBuffer;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue