From a486b31e4ed44a6cbc32ba73ee137c4265e4a48b Mon Sep 17 00:00:00 2001
From: taynpg <taynpg@163.com>
Date: Thu, 19 Dec 2024 16:59:50 +0800
Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=B0=9D=E8=AF=95=E4=BF=AE?=
 =?UTF-8?q?=E6=AD=A3=E6=9F=90=E4=B8=AA=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=B4=A9?=
 =?UTF-8?q?=E6=BA=83=E5=AF=BC=E8=87=B4=E4=B8=8E=E5=85=B6=E4=BC=A0=E8=BE=93?=
 =?UTF-8?q?=E7=9A=84=E5=AE=A2=E6=88=B7=E7=AB=AF=E4=B9=9F=E5=B4=A9=E6=BA=83?=
 =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 server/server.cpp | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/server/server.cpp b/server/server.cpp
index 4aa1cc1..155c155 100644
--- a/server/server.cpp
+++ b/server/server.cpp
@@ -274,12 +274,18 @@ bool CTcpServer::send_frame(std::shared_ptr<asio::ip::tcp::socket> socket, CFram
         logger_->error("{} pack failed.", __FUNCTION__);
         return false;
     }
-    if (!socket->send(asio::buffer(out_buf, out_len))) {
-        logger_->error("{} send failed, buf type:{}, fid:{}, tid:{}", __FUNCTION__,
-                       static_cast<int>(buf->type_), buf->fid_, buf->tid_);
-        delete[] out_buf;
-        return false;
+    try {
+        if (!socket->send(asio::buffer(out_buf, out_len))) {
+            logger_->error("{} send failed, buf type:{}, fid:{}, tid:{}", __FUNCTION__,
+                           static_cast<int>(buf->type_), buf->fid_, buf->tid_);
+            delete[] out_buf;
+            return false;
+        }
+    } catch (const std::exception& e) {
+        logger_->error("send failed, type:{}, fid:{}, tid:{}, mark:{}", static_cast<int>(buf->type_),
+                       buf->fid_, buf->tid_, buf->mark_);
     }
+
     delete[] out_buf;
     return true;
 }