Buttplug sex toy control library
20
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: Correct a timing issue with a RwLock in JoyHub devices

authored by

blackspherefollower and committed by
qDot
07ddf2c9 d1469690

+7 -7
+3 -3
buttplug/src/server/device/protocol/joyhub.rs
··· 57 57 new_commands: &[Option<(ActuatorType, u32)>], 58 58 exclude: Vec<usize>, 59 59 ) -> bool { 60 - let old_commands = old_commands_lock.try_read().expect("locks should work"); 60 + let old_commands = old_commands_lock.read().expect("locks should work"); 61 61 if old_commands.len() != new_commands.len() { 62 62 return true; 63 63 } ··· 135 135 async_manager::spawn(async move { delayed_constrict_handler(dev, cmd.1 as u8).await }); 136 136 cmd2 = None; 137 137 } else { 138 - let mut command_writer = self.last_cmds.try_write().expect("Locks should work"); 138 + let mut command_writer = self.last_cmds.write().expect("Locks should work"); 139 139 *command_writer = commands.to_vec(); 140 140 141 141 return Ok(vec![HardwareWriteCmd::new( ··· 155 155 } 156 156 } 157 157 158 - let mut command_writer = self.last_cmds.try_write().expect("Locks should work"); 158 + let mut command_writer = self.last_cmds.write().expect("Locks should work"); 159 159 *command_writer = commands.to_vec(); 160 160 Ok(vec![HardwareWriteCmd::new( 161 161 Endpoint::Tx,
+4 -4
buttplug/src/server/device/protocol/joyhub_v2.rs
··· 50 50 new_commands: &[Option<(ActuatorType, u32)>], 51 51 exclude: Vec<usize>, 52 52 ) -> bool { 53 - let old_commands = old_commands_lock.try_read().expect("locks should work"); 53 + let old_commands = old_commands_lock.read().expect("locks should work"); 54 54 if old_commands.len() != new_commands.len() { 55 55 return true; 56 56 } ··· 128 128 async_manager::spawn(async move { delayed_constrict_handler(dev, cmd.1 as u8).await }); 129 129 cmd2 = None; 130 130 } else { 131 - let mut command_writer = self.last_cmds.try_write().expect("Locks should work"); 131 + let mut command_writer = self.last_cmds.write().expect("Locks should work"); 132 132 *command_writer = commands.to_vec(); 133 133 134 134 return Ok(vec![HardwareWriteCmd::new( ··· 148 148 async_manager::spawn(async move { delayed_constrict_handler(dev, cmd.1 as u8).await }); 149 149 cmd3 = None; 150 150 } else { 151 - let mut command_writer = self.last_cmds.try_write().expect("Locks should work"); 151 + let mut command_writer = self.last_cmds.write().expect("Locks should work"); 152 152 *command_writer = commands.to_vec(); 153 153 154 154 return Ok(vec![HardwareWriteCmd::new( ··· 161 161 } 162 162 } 163 163 164 - let mut command_writer = self.last_cmds.try_write().expect("Locks should work"); 164 + let mut command_writer = self.last_cmds.write().expect("Locks should work"); 165 165 *command_writer = commands.to_vec(); 166 166 Ok(vec![HardwareWriteCmd::new( 167 167 Endpoint::Tx,