소스 검색

LOGE ikcp_send

ithewei 3 년 전
부모
커밋
6386d17bcd
3개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      event/hevent.h
  2. 4 1
      event/kcp/hkcp.c
  3. 1 1
      event/nio.c

+ 1 - 1
event/hevent.h

@@ -97,7 +97,7 @@ struct hperiod_s {
 };
 
 QUEUE_DECL(offset_buf_t, write_queue);
-// sizeof(struct hio_s)=400 on linux-x64
+// sizeof(struct hio_s)=408 on linux-x64
 struct hio_s {
     HEVENT_FIELDS
     // flags

+ 4 - 1
event/kcp/hkcp.c

@@ -80,7 +80,10 @@ int hio_write_kcp(hio_t* io, const void* buf, size_t len) {
     kcp_t* kcp = hio_get_kcp(io, conv);
     int nsend = ikcp_send(kcp->ikcp, (const char*)buf, len);
     // printf("ikcp_send len=%d nsend=%d\n", (int)len, nsend);
-    if (nsend < 0) return nsend;
+    if (nsend < 0) {
+        hloge("ikcp_send error: %d", nsend);
+        return nsend;
+    }
     ikcp_update(kcp->ikcp, (IUINT32)io->loop->cur_hrtime / 1000);
     return len;
 }

+ 1 - 1
event/nio.c

@@ -456,7 +456,7 @@ int hio_write (hio_t* io, const void* buf, size_t len) {
 #if WITH_KCP
     if (io->io_type == HIO_TYPE_KCP) {
         nwrite = hio_write_kcp(io, buf, len);
-        if (nwrite < 0) goto write_error;
+        // if (nwrite < 0) goto write_error;
         goto write_done;
     }
 #endif