Guest User

Untitled

a guest
Dec 10th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. struct tls_uv_connection_state_private_members {
  2. server_state_t* server;
  3. uv_tcp_t* handle;
  4. SSL *ssl;
  5. BIO *read, *write;
  6. struct {
  7. tls_uv_connection_state_t** prev_holder;
  8. tls_uv_connection_state_t* next;
  9. int in_queue;
  10. size_t pending_writes_count;
  11. uv_buf_t* pending_writes_buffer;
  12. } pending;
  13. size_t used_buffer, to_scan;
  14. int flags;
  15. };
  16.  
  17. #define RESERVED_SIZE (64 - sizeof(struct tls_uv_connection_state_private_members))
  18. #define MSG_SIZE (8192 - sizeof(struct tls_uv_connection_state_private_members) - 64 - RESERVED_SIZE)
  19.  
  20.  
  21. // This struct is exactly 8KB in size, this
  22. // means it is two OS pages and is easy to work with
  23. typedef struct tls_uv_connection_state {
  24. struct tls_uv_connection_state_private_members;
  25. char reserved[RESERVED_SIZE];
  26. char user_data[64]; // location for user data, 64 bytes aligned, 64 in size
  27. char buffer[MSG_SIZE];
  28. } tls_uv_connection_state_t;
  29.  
  30. static_assert(offsetof(tls_uv_connection_state_t, user_data) % 64 == 0, "tls_uv_connection_state_t.user should be 64 bytes aligned");
  31. static_assert(sizeof(tls_uv_connection_state_t) == 8192, "tls_uv_connection_state_t should be 8KB");
Add Comment
Please, Sign In to add comment