summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/srvrec.cc
Commit message (Collapse)AuthorAgeFilesLines
* srvrec: Use re-entrant resolver functionsJulian Andres Klode2019-08-221-2/+7
| | | | | This should probably make those functions thread-safe, which might be useful for some external users.
* don't try SRV requests based on IP addressesDavid Kalnischkies2018-05-111-0/+10
| | | | | IP addresses are by definition not a domain so in the best case the requests will just fail; we can do better than that on our own.
* Reformat and sort all includes with clang-formatJulian Andres Klode2017-07-121-3/+1
| | | | | | | | | | | | | This makes it easier to see which headers includes what. The changes were done by running git grep -l '#\s*include' \ | grep -E '.(cc|h)$' \ | xargs sed -i -E 's/(^\s*)#(\s*)include/\1#\2 include/' To modify all include lines by adding a space, and then running ./git-clang-format.sh.
* ensure a good clock() value for usage and testsDavid Kalnischkies2016-08-121-1/+1
| | | | | | | | | | | We use clock() as a very cheap way of getting a "random" value, but the manpage warns that this could return -1, so we should be dealing with this. Additionally, e.g. on hurd-i386 the value increases only slowly – to slow for our fast running tests for randomness hence producing the same range in both samples, so we introduce a simple busy-wait loop (as clock is counting processor time used by the program) in the test which delays the second sample just enough making our randomness a bit more predictable.
* srvrec: Do not expose C++11 tuple use in headerJulian Andres Klode2015-10-301-0/+7
| | | | This makes non-C++11 reverse deps wishing to use it FTBFS.
* GetSrvRecords: Make thread-safeJulian Andres Klode2015-10-301-2/+7
| | | | Gbp-Dch: ignore
* avoid triggering the c++11 erase api change on travisDavid Kalnischkies2015-09-021-2/+2
| | | | Git-Dch: Ignore
* use clock() as source for SRV randomnessDavid Kalnischkies2015-09-011-22/+10
| | | | | | | | | | | | | | | Initializing a random number generator with the time since epoch could be good enough, but reaches its limits in test code as the 100 iterations might very well happen in the same second and hence the seed number is always the same… clock() has a way lower resolution so it changes more often and not unimportant: If many users start the update at the same time it isn't to unlikely the SRV record will be ordered in the same second choosing the same for them all, but it seems less likely that the exact same clock() time has passed for them. And if I have to touch this, lets change a few other things as well to make me and/or compilers a bit happier (clang complained about the usage of a GNU extension in the testcase for example).
* Add basic (non weight adjusted) shuffling for SrvRecords selectionMichael Vogt2015-08-201-3/+56
| | | | | Also add "Debug::Acquire::SrvRecs" debug option and the option "Acquire::EnableSrvRecods" to allow disabling this lookup.
* apt-pkg/contrib/srvrec.cc: res_query() should not generate a _error->Warning()Michael Vogt2015-08-181-0/+2
|
* cleanupMichael Vogt2015-08-181-5/+5
|
* WIP start randomizingMichael Vogt2014-05-231-2/+29
|
* WIP make connect use GetSrvRecordsMichael Vogt2014-05-221-0/+14
|
* add sorting by priorityMichael Vogt2014-05-201-0/+7
|
* add GetSrvRecord helper to apt-pkg/contrib/srvrec.{cc,h}Michael Vogt2014-05-201-0/+93