Improve merge_choose_remote_location.

GitOrigin-RevId: 0c145a4a1f6d43ebdf5eb618b581539f31eabc40
This commit is contained in:
levlam 2019-02-05 01:45:16 +03:00
parent c08cbd5b54
commit 833bbdbb11

View File

@ -1014,12 +1014,20 @@ static int merge_choose_remote_location(const FullRemoteFileLocation &x, int8 x_
return !x_ref; return !x_ref;
} }
if (x.get_raw_file_reference() != y.get_raw_file_reference()) { if (x.get_raw_file_reference() != y.get_raw_file_reference()) {
if (x_source != y_source) {
return x_source < y_source; return x_source < y_source;
} }
// prefer newest among two server locations
return 0;
}
} }
if (x.get_access_hash() != y.get_access_hash()) { if (x.get_access_hash() != y.get_access_hash()) {
if (x_source != y_source) {
return x_source < y_source; return x_source < y_source;
} }
// prefer newest among two server locations
return 0;
}
return 2; return 2;
} }
static int merge_choose_remote_location(const RemoteFileLocation &x, int8 x_source, const RemoteFileLocation &y, static int merge_choose_remote_location(const RemoteFileLocation &x, int8 x_source, const RemoteFileLocation &y,