Christian Hesse <list@eworm.de> on Thu, 2022/01/13 15:44:
Allan McRae <allan@archlinux.org> on Fri, 2022/01/14 00:36:
On 14/1/22 00:12, Christian Hesse wrote:
Allan McRae <allan@archlinux.org> on Thu, 2022/01/13 23:52:
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?
Why limit to just one cache server? For me (with pacredir) this would be sufficient, but I guess others will complain: Having several servers in a network sharing their cache you could add all of them to the configuration:
[core] CacheServer = http://server-a.localdomain/ CacheServer = http://server-b.localdomain/ Server = ...
Currently we have a 'struct server_error_count': struct server_error_count { char server[HOSTNAME_SIZE]; unsigned int errors; }; How about implementing 'struct cache_servers'? struct server_error_count { char server[HOSTNAME_SIZE]; unsigned int errors; }; Or modify to hold both options? struct server_opts { char server[HOSTNAME_SIZE]; unsigned int cache; unsigned int errors; }; -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];) putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);}