tokio_kcp icon indicating copy to clipboard operation
tokio_kcp copied to clipboard

KcpSession io_task_handle loop 不结束

Open Jaredjin opened this issue 1 year ago • 3 comments

server模式下, 循环不结束,是否应该添加 input_rx.recv() 失败时结束循环?

let io_task_handle = { let session = session.clone(); tokio::spawn(async move { let mut input_buffer = [0u8; 65536];

            loop {
                tokio::select! {
                    recv_result = udp_socket.recv(&mut input_buffer), if is_client => {
                        ...
                    }

                    // bytes received from listener socket
                    input_opt = input_rx.recv() => {
                        ...
                        } else {
                            // 这里结束循环???
                            break;
                        }
                    }
                }
            }
        })
    };

Jaredjin avatar Aug 08 '23 06:08 Jaredjin