mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-11-04 01:47:27 +03:00 
			
		
		
		
	Don't disconnect sender on cancellation (#958)
This was causing a "race condition" where the sender would be disconnected after cancellation when another was created.
This commit is contained in:
		
							parent
							
								
									171e13daa9
								
							
						
					
					
						commit
						f0cd1fdd6e
					
				| 
						 | 
				
			
			@ -386,7 +386,6 @@ class MTProtoSender:
 | 
			
		|||
                except asyncio.TimeoutError:
 | 
			
		||||
                    continue
 | 
			
		||||
                except asyncio.CancelledError:
 | 
			
		||||
                    await self.disconnect()
 | 
			
		||||
                    return
 | 
			
		||||
                except Exception as e:
 | 
			
		||||
                    if isinstance(e, ConnectionError):
 | 
			
		||||
| 
						 | 
				
			
			@ -426,7 +425,6 @@ class MTProtoSender:
 | 
			
		|||
            except asyncio.TimeoutError:
 | 
			
		||||
                continue
 | 
			
		||||
            except asyncio.CancelledError:
 | 
			
		||||
                await self.disconnect()
 | 
			
		||||
                return
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
                if isinstance(e, ConnectionError):
 | 
			
		||||
| 
						 | 
				
			
			@ -470,7 +468,6 @@ class MTProtoSender:
 | 
			
		|||
                             .format(e.invalid_constructor_id, e.remaining))
 | 
			
		||||
                continue
 | 
			
		||||
            except asyncio.CancelledError:
 | 
			
		||||
                await self.disconnect()
 | 
			
		||||
                return
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
                __log__.exception('Unhandled exception while unpacking %s',e)
 | 
			
		||||
| 
						 | 
				
			
			@ -479,7 +476,6 @@ class MTProtoSender:
 | 
			
		|||
                try:
 | 
			
		||||
                    await self._process_message(message)
 | 
			
		||||
                except asyncio.CancelledError:
 | 
			
		||||
                    await self.disconnect()
 | 
			
		||||
                    return
 | 
			
		||||
                except Exception as e:
 | 
			
		||||
                    __log__.exception('Unhandled exception while '
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user