Possibly fix wrong requests order.
This commit is contained in:
		
							parent
							
								
									5e3e9ba824
								
							
						
					
					
						commit
						84ec2a5f74
					
				
					 1 changed files with 16 additions and 3 deletions
				
			
		| 
						 | 
					@ -1020,12 +1020,25 @@ void Instance::Private::sendRequest(
 | 
				
			||||||
	const auto signedDcId = toMainDc ? -realShiftedDcId : realShiftedDcId;
 | 
						const auto signedDcId = toMainDc ? -realShiftedDcId : realShiftedDcId;
 | 
				
			||||||
	registerRequest(requestId, signedDcId);
 | 
						registerRequest(requestId, signedDcId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (afterRequestId) {
 | 
					 | 
				
			||||||
		request->after = getRequest(afterRequestId);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	request->lastSentTime = crl::now();
 | 
						request->lastSentTime = crl::now();
 | 
				
			||||||
	request->needsLayer = needsLayer;
 | 
						request->needsLayer = needsLayer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (afterRequestId) {
 | 
				
			||||||
 | 
							request->after = getRequest(afterRequestId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (request->after) {
 | 
				
			||||||
 | 
								// Check if this after request is waiting in _dependentRequests.
 | 
				
			||||||
 | 
								// This happens if it was after some other request and failed
 | 
				
			||||||
 | 
								// to wait for it, but that other request is still processed.
 | 
				
			||||||
 | 
								QMutexLocker locker(&_dependentRequestsLock);
 | 
				
			||||||
 | 
								const auto i = _dependentRequests.find(afterRequestId);
 | 
				
			||||||
 | 
								if (i != end(_dependentRequests)) {
 | 
				
			||||||
 | 
									_dependentRequests.emplace(requestId, afterRequestId);
 | 
				
			||||||
 | 
									return;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	session->sendPrepared(request, msCanWait);
 | 
						session->sendPrepared(request, msCanWait);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue