int check_port(meshlink_handle_t *mesh) {
for(int i = 0; i < 1000; i++) {
- int port = 0x1000 + prng(mesh, 0x8000);
+ int port = 0x1000 + prng(mesh, 0x7000);
if(try_bind(mesh, port)) {
free(mesh->myport);
/* Ensure the poll callback is set, and call it right now to push data if possible */
utcp_set_poll_cb(channel->c, channel_poll);
- size_t todo = MIN(len, utcp_get_rcvbuf_free(channel->c));
+ size_t todo = MIN(len, utcp_get_sndbuf_free(channel->c));
if(todo) {
channel_poll(channel->c, todo);
/* Ensure the poll callback is set, and call it right now to push data if possible */
utcp_set_poll_cb(channel->c, channel_poll);
- size_t left = utcp_get_rcvbuf_free(channel->c);
+ size_t left = utcp_get_sndbuf_free(channel->c);
if(left) {
channel_poll(channel->c, left);