Skip to content

Conversation

@Lion-Yu-Bro
Copy link

I add a member to kcp_setting_t so that it can allow recv larger package in kcp session.
I wonder whether it's reasonable or not, or larger package will rersult in some performace matter(maybe that's why it's not supported before)?

// NOTE: alloc kcp->readbuf now, otherwise hio_read_kcp will use default size (DEFAULT_KCP_READ_BUFSIZE)
if (setting->rcv_bufsize > 0) {
kcp->readbuf.len = setting->rcv_bufsize;
HV_ALLOC(kcp->readbuf.base, kcp->readbuf.len);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you shoud use hio_alloc_readbuf,and hio_free_readbuf is called when hio_done.

Copy link
Author

@Lion-Yu-Bro Lion-Yu-Bro Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you shoud use hio_alloc_readbuf,and hio_free_readbuf is called when hio_done.

HV_FREE already used in kcp_release(which will be called in hio_close -> hio_done ->rudp_cleanup->rudp_entry_free), so I called HV_ALLOC here

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I've reviewed it again, and the readbuf here is kcp_s own readbuf, unrelated to hio_s, and can be allocated here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants