-
-
Save kellabyte/1dfd7ac30003b860d09757ebfe885696 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POINTERS 1:0x7fc4e1002c00 0x7fc4e1002c00 | |
POINTERS 2:0x7fc4e1002c00 0x10d2fbc3b <--- WHY IS THIS POINTER WRONG? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct connection { | |
uv_tcp_t stream; | |
uv_buf_t buffer; | |
} connection; | |
void uv_stream_on_alloc(uv_handle_t* client, size_t suggested_size, uv_buf_t* buf) { | |
connection* conn = (connection*)client->data; | |
char *buffer = (char *)malloc(suggested_size) | |
*buf = uv_buf_init(buffer, suggested_size); | |
conn->buffer = *buf; | |
printf("POINTERS 1:%p\t%p\n", conn->buffer.base, buf->base); | |
} | |
void uv_stream_on_read(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { | |
connection* conn = (connection*)client->data; | |
printf("POINTERS 2:%p\t%p\n", conn->buffer.base, buf->base); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment