From 1beccb77e57c53051160d664ccbb087835ac015a Mon Sep 17 00:00:00 2001 From: Jokler Date: Tue, 11 Aug 2020 16:50:02 +0200 Subject: Shut down on disconnect --- src/teamspeak/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/teamspeak') diff --git a/src/teamspeak/mod.rs b/src/teamspeak/mod.rs index b53d1d0..dfff368 100644 --- a/src/teamspeak/mod.rs +++ b/src/teamspeak/mod.rs @@ -19,6 +19,7 @@ mod bbcode; pub use bbcode::*; pub struct TeamSpeakConnection { + id: ClientId, conn: Connection, } @@ -106,7 +107,8 @@ impl TeamSpeakConnection { }), ); - Ok(TeamSpeakConnection { conn }) + let id = conn.lock().own_client; + Ok(TeamSpeakConnection { conn, id }) } pub fn send_audio_packet(&self, samples: &[u8]) { @@ -169,6 +171,10 @@ impl TeamSpeakConnection { .channel } + pub fn my_id(&self) -> ClientId { + self.id + } + pub fn user_count(&self, channel: ChannelId) -> u32 { let conn = self.conn.lock(); let mut count = 0; -- cgit v1.2.3-70-g09d2