aboutsummaryrefslogtreecommitdiff
path: root/lbclient.go
AgeCommit message (Collapse)AuthorFilesLines
2023-12-13chore: Add missing dots at the end of comments (#1677)Gravatar Oleksandr Redko 1-7/+7
2023-08-26Update golangci-lint and gosec (#1609)v1.49.0Gravatar Erik Dubbelboer 1-1/+1
2023-03-30get rid of some panics (#1526)Gravatar Moritz Poldrack 1-0/+1
* client: simplify (*HostClient).do() Remove an allocation in favour of deferring a call to release the response. * client: remove panic in dialAddr Return an error instead of panicking if the user supplied a nonsensical DialFunc. * compression: remove panic on invalid compression level If a compression level exceeding gzip's boundaries is provided, fasthttp will panic. Instead it would be better to handle this error for them by limiting it to the minimum or maximum value, depending on the direction the user has exceeded the limits. Clamp the value of gzip to always be between gzip.BestSpeed and gzip.BestCompression. * peripconn: remove panic on negative connection count When a negative count is reached when unregistering a connection, a panic is caused even though data-integrity is not at risk. Replace the panic() with a simple clamp on the value to ensure the value does not exceed it's expected lower bounds. References: #1504 * compress: remove error on failed nonblocking writes Since there is no way of handling or even logging non-critical errors in stateless non-blocking writecalls, just drop them and hope the user notices and tries again. * workerPool: remove panic on redundant Start and Stop calls Instead of panicking for invalid behaviour, it's preferable to just turn the function into a noop. * http: remove panic on invalid form boundary * http: remove panic on negative reads Since bufio already panics on negative reads, it is not necessary to do so as well. If the length is zero and for some reason no error is returned, readBodyIdentity and appendBodyFixedSize now errors in these cases. Link: https://github.com/golang/go/blob/851f6fd61425c810959c7ab51e6dc86f8a63c970/src/bufio/bufio.go#L246 * fs: remove panic on negative reader count When a negative count is reached when unregistering a reader, a panic is thrown even though data-integrity is not at risk. Replace the panic() with a simple clamp on the value to ensure the value does not exceed it's expected lower bounds. * server: remove panic in favour of a segfault Panicking with "BUG: " obscures the error. As the segfault causes a panic anyway, just let the chaos unfold. * server: remove panic in favour of returning an error Writing on a timed-out response is not endangering data integrity and just fails. * chore: add comments to all panics * chore: fix minor typo
2023-03-28optimize:reduce loop (#1532)Gravatar tyltr 1-4/+2
2023-02-13docs: fix grammar issues and typos in comments (#1492)Gravatar Oleksandr Redko 1-1/+1
2023-02-11Refactor golangci-lint config and remove redundant nolints (#1486)Gravatar Oleksandr Redko 1-1/+1
* Refactor golangci-lint config - Use golangci-lint-action for GitHub workflow. - Add additional golangci-lint run options. - Remove unused nolint directives. * Revert exclude-use-default option
2022-04-01support adding/removing clients from LBClient (#1243)Gravatar Cam Sweeney 1-0/+39
* support adding/removing clients from LBClient * add/remove BalancingClient to be more flexible * use RwMutex, lock for get * lock mutex for init * defer unlock for possible panic * fix removing client * fix filtering of slice * fix removing references to removed items Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2019-11-16Run golangci-lint using a Github ActionGravatar Erik Dubbelboer 1-1/+1
2019-10-20Use least total connections instead of round robin for lbclient (#673)Gravatar Erik Dubbelboer 1-30/+12
2017-10-08A lot of typo fixesGravatar xPushkin 1-1/+1
2016-11-09LBClient: prevent servers' hammering by randomizing the initial client to useGravatar Aliaksandr Valialkin 1-0/+4
2016-11-07LBClient: panic on empty ClientsGravatar Aliaksandr Valialkin 1-0/+3
2016-10-21Added an example for LBClientGravatar Aliaksandr Valialkin 1-3/+5
2016-10-20Added LBClient for balancing load among multiple clientsGravatar Aliaksandr Valialkin 1-0/+174
This will be used by httptp from https://github.com/valyala/httpteleport .