diff options
author | Simon Zhang <yuwei1.zhang@intel.com> | 2020-03-05 19:49:37 +0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2020-03-07 17:35:40 +0000 |
commit | ed019eae2796453356bb78799507e67af3ab363d (patch) | |
tree | 5d3da80dbe8449bf2a8553f1ad3d59060794e710 /src/plugins/tlspicotls/tls_picotls.h | |
parent | 1d94ab5f1b4557c9e017af7e9da0f821cae1fa72 (diff) |
tls: refactor ctx_write function to avoid allocate new memory every time
Type: refactor
Signed-off-by: Simon Zhang <yuwei1.zhang@intel.com>
Change-Id: Ic34729d58a4218046afacaffc765649beb056a24
Diffstat (limited to 'src/plugins/tlspicotls/tls_picotls.h')
-rw-r--r-- | src/plugins/tlspicotls/tls_picotls.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/tlspicotls/tls_picotls.h b/src/plugins/tlspicotls/tls_picotls.h index b8e802eb551..1a253f0e45c 100644 --- a/src/plugins/tlspicotls/tls_picotls.h +++ b/src/plugins/tlspicotls/tls_picotls.h @@ -12,6 +12,9 @@ #define TLS_RX_IS_LEFT(x) ((x)->rx_len != (x)->rx_offset) #define TLS_RX_LEFT_LEN(x) ((x)->rx_len - (x)->rx_offset) +#define TLS_WRITE_OFFSET(x) ((x)->write_buffer.base + (x)->write_buffer_offset) +#define TLS_WRITE_IS_LEFT(x) ((x)->write_buffer.off == (x)->write_buffer_offset) + typedef struct tls_ctx_picotls_ { @@ -21,6 +24,10 @@ typedef struct tls_ctx_picotls_ u8 *rx_content; int rx_offset; int rx_len; + ptls_buffer_t write_buffer; + uint8_t *write_content; + int write_buffer_offset; + int is_write_buffer_finished; } picotls_ctx_t; typedef struct tls_listen_ctx_picotls_ |