fix: invalid typing bytes because of 0xff in numbers
This commit is contained in:
		
							parent
							
								
									bcd1fe1856
								
							
						
					
					
						commit
						c15ae3c126
					
				
					 2 changed files with 7 additions and 3 deletions
				
			
		|  | @ -11,6 +11,7 @@ use ruma::{ | ||||||
| use std::{ | use std::{ | ||||||
|     collections::HashMap, |     collections::HashMap, | ||||||
|     convert::{TryFrom, TryInto}, |     convert::{TryFrom, TryInto}, | ||||||
|  |     mem, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #[derive(Clone)] | #[derive(Clone)] | ||||||
|  | @ -228,9 +229,11 @@ impl RoomEdus { | ||||||
|                 let key = key?; |                 let key = key?; | ||||||
|                 Ok::<_, Error>(( |                 Ok::<_, Error>(( | ||||||
|                     key.clone(), |                     key.clone(), | ||||||
|                     utils::u64_from_bytes(key.split(|&b| b == 0xff).nth(1).ok_or_else(|| { |                     utils::u64_from_bytes( | ||||||
|                         Error::bad_database("RoomTyping has invalid timestamp or delimiters.") |                         &key.splitn(2, |&b| b == 0xff).nth(1).ok_or_else(|| { | ||||||
|                     })?) |                             Error::bad_database("RoomTyping has invalid timestamp or delimiters.") | ||||||
|  |                         })?[0..mem::size_of::<u64>()], | ||||||
|  |                     ) | ||||||
|                     .map_err(|_| Error::bad_database("RoomTyping has invalid timestamp bytes."))?, |                     .map_err(|_| Error::bad_database("RoomTyping has invalid timestamp bytes."))?, | ||||||
|                 )) |                 )) | ||||||
|             }) |             }) | ||||||
|  |  | ||||||
|  | @ -28,6 +28,7 @@ impl Sending { | ||||||
|                 select! { |                 select! { | ||||||
|                     Some(server) = futures.next() => { |                     Some(server) = futures.next() => { | ||||||
|                         warn!("response: {:?}", &server); |                         warn!("response: {:?}", &server); | ||||||
|  |                         warn!("futures left: {}", &futures.len()); | ||||||
|                         match server { |                         match server { | ||||||
|                             Ok((server, _response)) => { |                             Ok((server, _response)) => { | ||||||
|                                 waiting_servers.remove(&server) |                                 waiting_servers.remove(&server) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue