kcp
kcp copied to clipboard
Possible documentation improvements
KCP is a popular and light-weighted library, which means that everyone can read its source code line by line, which will not take too much time. However, I think that the documentation can be further improved.
For example, the documentation for ikcp_send / ikcp_recv looks like this:
// user/upper level send, returns below zero for error
int ikcp_send(ikcpcb *kcp, const char *buffer, int len);
// user/upper level recv: returns size, returns below zero for EAGAIN
int ikcp_recv(ikcpcb *kcp, char *buffer, int len);
From the description, what happens when the return code is -1, -2 or -3 remains unknown, whether a success call returns some positive number or zero also remains unknown. In my point of view, KCP seems to be a library that we have to read its internal implementation before use.
I suggest using detailed doxygen-style documentation,in which the meaning of each parameter and return code are clearly defined. Coding suggestions (e.g., how to avoid buffer bloat by checking ikcp_waitsnd) can also be added to the documentation.