Commit 2f76ce9c by qlintonger xeno

成功解决CmdUpdateOnlineUsers的问题+尚未发现验证错误,等待后续验证

parent b6614cc5
......@@ -4,7 +4,7 @@ use crate::handles::close_connection::handle_connection_error;
use crate::handles::handle_messages::handle_other_message;
use crate::handles::handshake::handle_handshake;
use crate::handles::heartbeat::{handle_heartbeat, heart_resp};
use crate::handles::online_users_update::{send_online_users_resp, OnlineUserMessage, ServerOnlineUserMessage};
use crate::handles::online_users_update::{send_online_users_resp, ServerOnlineUserMessage};
use crate::handles::redis::{insert_this_connection, remove_this_connection};
use crate::utils::json_utils::{get_current_timestamp, parse_message};
use futures::{SinkExt, StreamExt};
......@@ -15,7 +15,6 @@ use std::time::{Duration, Instant};
use tokio::sync::mpsc::{Receiver, Sender, UnboundedSender};
use tokio::sync::RwLock as AsyncRwLock;
use tokio::time;
use tokio::time::interval;
use tokio_tungstenite::accept_hdr_async;
use tungstenite::handshake::server::{Request, Response};
use tungstenite::{Error, Message};
......@@ -256,8 +255,9 @@ async fn send_online_users_and_send(
from_id: "0".to_string(),
to_id: from_id.to_string(),
msg_data: messages,
time: get_current_timestamp()
}).map_err(|e| Error::Io(std::io::Error::new(std::io::ErrorKind::Other, e)))?;
time: get_current_timestamp(),
})
.map_err(|e| Error::Io(std::io::Error::new(std::io::ErrorKind::Other, e)))?;
if let Err(e) = sender.send(Message::text(json_message)).await {
println!("发送在线用户列表消息给用户 {} 失败: {}", from_id, e);
return Err(e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment