On 14/1/22 00:12, Christian Hesse wrote:
Allan McRae <allan@archlinux.org> on Thu, 2022/01/13 23:52:
On 13/1/22 23:11, Christian Hesse wrote:
Hello everybody,
I am still struggling with pacman having the server error limit enabled by default. My attempt to fix this for my use case with http headers [0] was reject.
Also someone proposed to add a configuration option to disable server error limit [1]... It was rejected as well.
But I guess the best way to solve this is finally implementing an option "CacheServer", as requested a long time ago [2]. Looks like Allan did not fine the "spare 30 minutes" [3] to implement... :)
Thus I would like to have a look. Still I would like to have a rough guide where to put what and how to glue things. Anybody wants to share some thoughts what an acceptable solution should look like?
[0] https://lists.archlinux.org/pipermail/pacman-dev/2021-May/025159.html [1] https://bugs.archlinux.org/task/71352 [2] https://bugs.archlinux.org/task/23407 [3] https://lists.archlinux.org/pipermail/pacman-dev/2021-June/025184.html
I have had a spare 5 minutes... you need to add a CacheServer global option to pacman.conf and wire that into pacman & libalpm. Then when forming the list of Servers in a download payload for a package, you need to add that server at the top and note that it is a cache server.
Sure, so we want to put cache and regular servers in a single list?
Currently this uses alpm_list_t, which is a doubly linked list. The servers are added as 'char *' there. Do we want to add a struct for servers which adds a field for storing its type?
typedef struct _alpm_server_t { int cache; char *server; } alpm_server_t;
Having not looked at this in detail... my initial reaction is no. Assuming we allow a single CacheServer, would it be more efficient to add the field into the payload struct?
Then in the try next server function, check if we are using the cache server, and silently move onto the normal servers.