mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-11-04 09:57:29 +03:00 
			
		
		
		
	Fix RPCError may occur for no parent message (#908)
This commit is contained in:
		
							parent
							
								
									7b4cd92066
								
							
						
					
					
						commit
						b3990546eb
					
				| 
						 | 
					@ -512,6 +512,12 @@ class MTProtoSender:
 | 
				
			||||||
        __log__.debug('Handling RPC result for message %d',
 | 
					        __log__.debug('Handling RPC result for message %d',
 | 
				
			||||||
                      rpc_result.req_msg_id)
 | 
					                      rpc_result.req_msg_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if not message:
 | 
				
			||||||
 | 
					            # TODO We should not get responses to things we never sent
 | 
				
			||||||
 | 
					            __log__.info('Received response without parent request: {}'
 | 
				
			||||||
 | 
					                         .format(rpc_result.body))
 | 
				
			||||||
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if rpc_result.error:
 | 
					        if rpc_result.error:
 | 
				
			||||||
            error = rpc_message_to_error(rpc_result.error)
 | 
					            error = rpc_message_to_error(rpc_result.error)
 | 
				
			||||||
            self._send_queue.put_nowait(self.state.create_message(
 | 
					            self._send_queue.put_nowait(self.state.create_message(
 | 
				
			||||||
| 
						 | 
					@ -520,8 +526,7 @@ class MTProtoSender:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if not message.future.cancelled():
 | 
					            if not message.future.cancelled():
 | 
				
			||||||
                message.future.set_exception(error)
 | 
					                message.future.set_exception(error)
 | 
				
			||||||
            return
 | 
					        else:
 | 
				
			||||||
        elif message:
 | 
					 | 
				
			||||||
            # TODO Would be nice to avoid accessing a per-obj read_result
 | 
					            # TODO Would be nice to avoid accessing a per-obj read_result
 | 
				
			||||||
            # Instead have a variable that indicated how the result should
 | 
					            # Instead have a variable that indicated how the result should
 | 
				
			||||||
            # be read (an enum) and dispatch to read the result, mostly
 | 
					            # be read (an enum) and dispatch to read the result, mostly
 | 
				
			||||||
| 
						 | 
					@ -531,11 +536,6 @@ class MTProtoSender:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if not message.future.cancelled():
 | 
					            if not message.future.cancelled():
 | 
				
			||||||
                message.future.set_result(result)
 | 
					                message.future.set_result(result)
 | 
				
			||||||
            return
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            # TODO We should not get responses to things we never sent
 | 
					 | 
				
			||||||
            __log__.info('Received response without parent request: {}'
 | 
					 | 
				
			||||||
                         .format(rpc_result.body))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async def _handle_container(self, message):
 | 
					    async def _handle_container(self, message):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user