From 88ed9e2707f0e929b2801b47975a0256a75e7653 Mon Sep 17 00:00:00 2001 From: Mock Date: Mon, 30 Mar 2026 15:03:38 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E5=A2=9E=E5=8A=A0=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=B5=8B=E8=AF=95=E8=BF=9E=E9=80=9A=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c/src/transport_kcp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/c/src/transport_kcp.c b/c/src/transport_kcp.c index 9614e06..c1e2aab 100644 --- a/c/src/transport_kcp.c +++ b/c/src/transport_kcp.c @@ -1541,6 +1541,7 @@ int kcp_conn_send(kcp_conn_t *conn, const message_t *msg) { uint8_t *frame = NULL; size_t frame_len = 0; int send_errno = 0; + int kcp_send_rc = 0; if (conn == NULL || msg == NULL) { errno = EINVAL; return -1; @@ -1554,9 +1555,10 @@ int kcp_conn_send(kcp_conn_t *conn, const message_t *msg) { pthread_mutex_lock(&conn->kcp_mu); atomic_store(&conn->sock_state->last_send_errno, 0); conn->kcp->current = omni_now_millis32(); - if (ikcp_send(conn->kcp, (const char *) frame, (int) frame_len) != 0) { + kcp_send_rc = ikcp_send(conn->kcp, (const char *) frame, (int) frame_len); + if (kcp_send_rc < 0) { pthread_mutex_unlock(&conn->kcp_mu); - errno = EIO; + errno = kcp_send_rc == -2 ? EMSGSIZE : EINVAL; free(frame); return -1; }