Skip to content

Commit

Permalink
Merge pull request #63 from NodeFactoryIo/hotix/socket-overflow
Browse files Browse the repository at this point in the history
Fix socket daemon errors
  • Loading branch information
mace authored Feb 23, 2021
2 parents 90d9487 + a4d5221 commit 99b5dc0
Show file tree
Hide file tree
Showing 7 changed files with 270 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.3.3
version=0.3.4
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [v0.3.4](https://github.com/NodeFactoryIo/vedran-daemon/tree/v0.3.4)

[Full Changelog](https://github.com/NodeFactoryIo/vedran-daemon/compare/v0.3.3...v0.3.4)

### Fixed
- Fix socket and request memory leaks [\#63](https://github.com/NodeFactoryIo/vedran-daemon/pull/63) ([mpetrun5](https://github.com/mpetrun5))

### Added

### Changed

## [v0.3.3](https://github.com/NodeFactoryIo/vedran-daemon/tree/v0.3.3)

[Full Changelog](https://github.com/NodeFactoryIo/vedran-daemon/compare/v0.3.2...v0.3.3)
Expand Down
10 changes: 8 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ module github.com/NodeFactoryIo/vedran-daemon
go 1.15

require (
github.com/NodeFactoryIo/vedran v0.1.2-0.20201012103221-1832974f2e38
github.com/NodeFactoryIo/vedran v0.5.4-0.20210223103850-bbeee18776e9
github.com/felixge/tcpkeepalive v0.0.0-20160804073959-5bb0b2dea91e // indirect
github.com/go-co-op/gocron v0.3.1
github.com/gorilla/websocket v1.4.0
github.com/golang/mock v1.3.1 // indirect
github.com/google/go-cmp v0.5.2 // indirect
github.com/gorilla/websocket v1.4.1
github.com/gosuri/uitable v0.0.4
github.com/kr/text v0.2.0 // indirect
github.com/mitchellh/mapstructure v1.3.3
github.com/prometheus/common v0.13.0
github.com/sirupsen/logrus v1.6.0
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.6.1
go.etcd.io/bbolt v1.3.5 // indirect
)
247 changes: 247 additions & 0 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/lb/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ func (c *Client) do(req *http.Request, v interface{}) (*http.Response, error) {
} else if resp.StatusCode != 200 {
return nil, fmt.Errorf("Request %v returned invalid status code %d", req, resp.StatusCode)
}
defer resp.Body.Close()

if v != nil {
defer resp.Body.Close()
body, _ := ioutil.ReadAll((resp.Body))
err = json.Unmarshal(body, &v)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions internal/lb/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ func (ms *metricsService) Send(client node.Client) (*http.Response, error) {
return nil, err
}

resp.Body.Close()
return resp, err
}
1 change: 1 addition & 0 deletions internal/lb/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ func (ps *pingService) Send() (*http.Response, error) {
return nil, err
}

resp.Body.Close()
return resp, err
}

0 comments on commit 99b5dc0

Please sign in to comment.