Reset session when cloned.
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				MoreThanText/morethantext/pipeline/head There was a failure building this commit
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	MoreThanText/morethantext/pipeline/head There was a failure building this commit
				
			This commit is contained in:
		
							
								
								
									
										18
									
								
								src/lib.rs
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/lib.rs
									
									
									
									
									
								
							@@ -39,7 +39,6 @@ mod test_message {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Application client to MoreThanText
 | 
			
		||||
#[derive(Clone)]
 | 
			
		||||
pub struct MoreThanText {
 | 
			
		||||
    session: Option<SessionData>,
 | 
			
		||||
    tx: Sender<Message>,
 | 
			
		||||
@@ -115,6 +114,15 @@ impl MoreThanText {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Clone for MoreThanText {
 | 
			
		||||
    fn clone(&self) -> Self {
 | 
			
		||||
        Self {
 | 
			
		||||
           session: None,
 | 
			
		||||
           tx: self.tx.clone(),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[cfg(test)]
 | 
			
		||||
mod mtt_client {
 | 
			
		||||
    use super::*;
 | 
			
		||||
@@ -140,4 +148,12 @@ mod mtt_client {
 | 
			
		||||
        mtt.open_session(None);
 | 
			
		||||
        assert_ne!(mtt.get_id(), id1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn cloned_clients_have_no_session() {
 | 
			
		||||
        let mut mtt = MoreThanText::new();
 | 
			
		||||
        mtt.open_session(None);
 | 
			
		||||
        let result = mtt.clone();
 | 
			
		||||
        assert!(result.session.is_none());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user