summaryrefslogtreecommitdiffstats
path: root/src/server/altservers.c
Commit message (Collapse)AuthorAgeFilesLines
* [SERVER] Honor uplinkTimeout directly when connecting to alt-serverSimon Rettberg2021-05-101-2/+1Star
|
* [SERVER] Fix warningsSimon Rettberg2020-11-231-1/+2
|
* [BUILD] rewrite CMake build system to track changes of source filesManuel Bentele2020-10-161-3/+3
| | | | | | | | | | This change restructures the source code directories, separates shared form non-shared application code and adds CMake dependencies. These dependencies allow the tracking of changes and trigger a rebuild of those build targets where changed files are involved. WARNING: Note that the support of the DNBD3_SERVER_AFL build option is not supported yet. Thus, the option should be never turned on.
* [SERVER] Know when to stopSimon Rettberg2020-06-101-1/+1
|
* [SERVER] Likewise, flush entire payload on RTT measurementSimon Rettberg2020-06-101-1/+6
|
* [SERVER] Fix check for RTT block reply sizeSimon Rettberg2020-06-101-1/+1
|
* [SERVER] Add name param to threadpool_runSimon Rettberg2020-03-191-1/+1
|
* [SERVER] Use first request in queue for RTT measurementsSimon Rettberg2020-03-171-6/+20
| | | | | | This makes sure the server we're potentially switching to can at least serve the next request in the queue, making sure some progress will be made.
* [SERVER] Add printf macro for image (name:rid as %s:%d)Simon Rettberg2020-03-061-2/+2
|
* [SERVER] Add timer task for saving cache mapsSimon Rettberg2020-03-041-0/+20
| | | | | | | | | Cache maps will now be saved periodically, but only if either they have a "dirty" bit set, which happens if any bits in the map get cleared again (due to corruption), or if new data has been replicated from an uplink server. This either means at least one byte received and 5 minutes have passed, or at least 500MB have been downloaded. The timer currently runs every 20 seconds.
* [SERVER] Remove "working" flag, introduce fine-grained flagsSimon Rettberg2020-03-031-4/+0Star
| | | | | | | | Tracking the "working" state of images using one boolean is insufficient regarding the different ways in which providing an image can fail. Introduce separate flags for different conditions, like "file not readable", "file not writable", "no uplink server available", "file content has changed".
* [SERVER] altservers: Fix missing index mapping (replication)Simon Rettberg2020-02-261-1/+1
|
* [SERVER] Support limiting alt-servers to specific namespaceSimon Rettberg2019-09-041-14/+37
| | | | | | Not really namespace but simple string matching for the image path. Path is matched from start with no support for glob or regex, so usually you want to have a trailing '/' to limit to certain directories.
* [SERVER] Fix altservers_getListForClient()Simon Rettberg2019-09-041-4/+54
| | | | | The score wasn't reset when adding clients to the list, resulting in exactly one server filling up the whole list.
* [SERVER] Fix compiler warningsSimon Rettberg2019-09-021-2/+2
|
* [SERVER] Remove old commentsSimon Rettberg2019-08-281-8/+0Star
|
* [SERVER] Handle closeUnusedFd via timerSimon Rettberg2019-08-281-8/+0Star
|
* [SERVER] Use reference counting for uplinkSimon Rettberg2019-08-271-4/+9
| | | | First step towards less locking for proxy mode
* [SERVER] Get rid of alt-servers thread, per-uplink rtt historySimon Rettberg2019-08-221-394/+344Star
| | | | | | | | | | Alt-Server checks are now run using the threadpool, so we don't need a queue and dedicated thread anymore. The rtt history is now kept per uplink, so many uplinks won't overwhelm the history, making its time window very short. Also the fail counter is now split up; a global one for when the server actually isn't reachable, a local (per-uplink) one for when the server is reachable but doesn't serve the requested image.
* [SERVER] Add struct representing active connection to uplink serverSimon Rettberg2019-08-181-15/+15
|
* [SERVER] uplink: More consistent type/variable namingSimon Rettberg2019-08-181-5/+5
| | | | | * Change link to uplink everywhere * dnbd3_connection_t -> dnbd3_uplink_t
* [SERVER] altservers: Don't run check if <= 1 alt server availableSimon Rettberg2019-08-181-4/+11
|
* [SERVER] Better lock debugging: Always check lock orderSimon Rettberg2019-08-071-4/+5
| | | | | | Lock order is predefined in locks.h. Immediately bail out if a lock with lower priority is obtained while the same thread already holds one with higher priority.
* [SERVER] Lock-free queue for altservers check threadSimon Rettberg2019-08-071-44/+53
|
* [SERVER] Turn all spinlocks into mutexesSimon Rettberg2019-07-261-50/+51
| | | | | | | | Just assume sane platforms offer smart mutexes that have a fast-path with spinlocks internally for locks that have little to no congestion. In all other cases, mutexes should perform better anyways.
* [SERVER] altservers.c: Improve log outputSimon Rettberg2019-01-311-17/+19
|
* [SERVER] Don't keep an uplink connection established foreverSimon Rettberg2019-01-311-1/+1
| | | | | | In case we don't use background replication a connection to an uplink server can potentially stay around forever. This in turn would prevent the uplink server from freeing the image as it appears to be in use.
* [SERVER] Lower log-level of non-critical messageSimon Rettberg2019-01-301-1/+1
|
* [SERVER] Refactor uplink/cache handling, improve crc checkingSimon Rettberg2018-07-041-17/+9Star
| | | | | | | | | | | | | The cacheFd is now moved to the uplink data structure and will only be handled by the uplink thread. The integrity checker now supports checking all blocks of an image. This will be triggered automatically whenever a check for a single block failed. Also, if a crc check on startup fails, the image won't be discarded anymore, but rather a full check will be initiated. Furthermore, when calling image_updateCacheMap() on an image that was previously complete, the cache map will now be re-initialized, and a new uplink connection created.
* [SERVER] Acquire write lock before initializing arraySimon Rettberg2018-04-161-1/+5
|
* [SERVER] altservers: Short timeout during RTT measurement, round request rangeSimon Rettberg2017-11-081-1/+3
| | | | | Rounding to 4k so caching works efficiently This should now close #3231
* [SERVER] rpc: Add q=logfile, q=altservers and q=config to /querySimon Rettberg2017-11-081-0/+30
|
* [SERVER] altservers: Tweak, cleanup, refactor, renameSimon Rettberg2017-11-081-18/+28
|
* [SERVER] Support finer control over replication when a proxy connects to a proxySimon Rettberg2017-11-021-1/+1
| | | | | | | Introduce new flag in "select image" message to tell the uplink server whether we have background replication enabled or not. Also reject a connecting proxy if the connecting proxy uses BGR but we don't, as this would basically force the image to be replicated locally too.
* [*] Mark logadd() as printf-style function, fix errors that it revealedSimon Rettberg2017-10-311-1/+1
| | | | ...there were quite a few format string errors as it turns out :/
* [*] Introduce constants for IPv4/6 in dnbd3_host_tSimon Rettberg2017-10-281-1/+1
| | | | | | | AF_INET luckily was "2" on all platforms checked, so no problems there with interoperation, but AF_INET6 is different between Linux, BSD, Windows and possibly others, so map back and forth between AF_INET/AF_INET6 and HOST_IP4/HOST_IP6 to fix this.
* [SERVER] Improve altserver handling and selectionSimon Rettberg2017-10-251-26/+41
| | | | | | We order the list so that servers that fail are kept at the end of the list. This is so that when we fetch servers for RTT measurement, we're less likely to pick those.
* [SERVER] Initialize PRNGSimon Rettberg2017-10-241-0/+1
|
* [SERVER] Fix types or add explicit casts everywhere we might have type ↵Simon Rettberg2017-10-241-2/+2
| | | | conversion problems
* [SERVER] Use monotonic clock for measuring timeSimon Rettberg2017-10-191-13/+17
| | | | | Introduces new shared source unit timing.[ch] Closes #3214
* [SERVER] More tweaks to alt-server selection wrt proxy cyclesSimon Rettberg2017-10-181-4/+9
| | | | | This needs an overhaul; status needs to be moved from global alt-servers list to individual uplinks
* [SERVER] Try to connect to different server if proxy cycle is detectedSimon Rettberg2017-10-171-7/+17
|
* [*] Support hop-counting in request header, protocol version 3Simon Rettberg2017-10-171-1/+4
| | | | | | | | | | | | | | We steal 8 bits from the request offset to count hops when requests get relayed by proxies. This still leaves plenty of bits for the offset (56 bits, supporting images of up to 72 petabytes). This is used to detect proxy cycles. The algorithm is not perfect but should prevent endless relays of the same request. This is backwards compatible to old clients and servers, as the server only ever sets the hopcount in relayed requests if the upstream server is using protocol version 3 or newer, and clients are automatically upwards compatible as there is practically no image larger than 74PB, so the newly introduced hop count field is always 0 even in requests from old clients.
* [SERVER] Helper function for loading line based space separated data from fileSimon Rettberg2017-10-011-33/+27Star
|
* [SERVER] Fix closing timeout reset, fix log messagesSimon Rettberg2017-09-081-0/+1
|
* [SERVER] Implement closeUnusedFd config optionSimon Rettberg2017-09-021-0/+5
| | | | | | | This will close the readFd of images that have no active clients after some idle period (1 hour currently). Prevents deleted images from taking up space until the server is shut down.
* [*] Continue splitting #defines to clientconfig.h etc.Simon Rettberg2017-09-021-1/+1
|
* [SERVER] Split server-only defs from config.h to serverconfig.hSimon Rettberg2017-08-261-0/+1
|
* [SERVER] Remove stray lineSimon Rettberg2017-04-271-1/+0Star
|
* [SERVER] Fix formattingSimon Rettberg2016-03-221-6/+6
|