From ea2c102e6162c924c682aabfe8a052ce9a766a4d Mon Sep 17 00:00:00 2001
From: hnluo <haoneng.lhn@alibaba-inc.com>
Date: 星期四, 10 八月 2023 20:17:53 +0800
Subject: [PATCH] Merge pull request #832 from alibaba-damo-academy/dev_lhn
---
funasr/runtime/websocket/websocket-server-2pass.cpp | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/funasr/runtime/websocket/websocket-server-2pass.cpp b/funasr/runtime/websocket/websocket-server-2pass.cpp
index 0b92c97..82beb1c 100644
--- a/funasr/runtime/websocket/websocket-server-2pass.cpp
+++ b/funasr/runtime/websocket/websocket-server-2pass.cpp
@@ -152,8 +152,10 @@
} catch (std::exception const& e) {
LOG(ERROR) << e.what();
}
- for (auto& vec : punc_cache) {
- vec.clear();
+ if(punc_cache.size()>0){
+ for (auto& vec : punc_cache) {
+ vec.clear();
+ }
}
if (Result) {
websocketpp::lib::error_code ec;
@@ -178,7 +180,11 @@
void WebSocketServer::on_open(websocketpp::connection_hdl hdl) {
scoped_lock guard(m_lock); // for threads safty
- check_and_clean_connection(); // remove closed connection
+ try{
+ check_and_clean_connection(); // remove closed connection
+ }catch (std::exception const& e) {
+ std::cerr << "Error: " << e.what() << std::endl;
+ }
std::shared_ptr<FUNASR_MESSAGE> data_msg =
std::make_shared<FUNASR_MESSAGE>(); // put a new data vector for new
--
Gitblit v1.9.1