Skip to content

Commit 2c419b1

Browse files
committed
proxy: Unexport methods that do not satisfy rpc to remove warning
Change-Id: Icd4173edc55d83b1766f204184eb818b859e648e Signed-off-by: Ondrej Fabry <[email protected]>
1 parent db87efa commit 2c419b1

File tree

4 files changed

+31
-14
lines changed

4 files changed

+31
-14
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,24 @@ This file lists changes for the GoVPP releases.
1111
-
1212
-->
1313

14+
## 0.3.3
15+
> _9 April 2020_
16+
17+
### Fixes
18+
- proxy: Unexport methods that do not satisfy rpc to remove warning
19+
1420
## 0.3.2
1521
> _20 March 2020_
1622
1723
### Fixes
1824
- statsclient: Fix panic occurring with VPP 20.05-rc0 (master)
1925

26+
## 0.3.1
27+
> _18 March 2020_
28+
29+
### Fixes
30+
- Fix import path in examples/binapi
31+
2032
## 0.3.0
2133
> _18 March 2020_
2234

proxy/log.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package proxy
22

33
import (
4+
"io"
45
"os"
56

67
"github.com/sirupsen/logrus"
@@ -13,19 +14,23 @@ var (
1314
)
1415

1516
func init() {
16-
log.Out = os.Stdout
1717
if debug {
1818
log.Level = logrus.DebugLevel
1919
log.Debugf("govpp/proxy: debug mode enabled")
2020
}
2121
}
2222

23-
// SetLogger sets global logger to l.
23+
// SetLogger sets logger.
2424
func SetLogger(l *logrus.Logger) {
2525
log = l
2626
}
2727

28-
// SetLogLevel sets global logger level to lvl.
28+
// SetLogLevel sets log level for logger.
2929
func SetLogLevel(lvl logrus.Level) {
3030
log.Level = lvl
3131
}
32+
33+
// SetOutput sets log output for logger.
34+
func SetLogOutput(out io.Writer) {
35+
log.Out = out
36+
}

proxy/proxy.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ func NewServer() (*Server, error) {
5151
}
5252

5353
func (p *Server) ConnectStats(stats adapter.StatsAPI) error {
54-
return p.statsRPC.Connect(stats)
54+
return p.statsRPC.connect(stats)
5555
}
5656

5757
func (p *Server) DisconnectStats() {
58-
p.statsRPC.Disconnect()
58+
p.statsRPC.disconnect()
5959
}
6060

6161
func (p *Server) ConnectBinapi(binapi adapter.VppAPI) error {
62-
return p.binapiRPC.Connect(binapi)
62+
return p.binapiRPC.connect(binapi)
6363
}
6464

6565
func (p *Server) DisconnectBinapi() {
66-
p.binapiRPC.Disconnect()
66+
p.binapiRPC.disconnect()
6767
}
6868

6969
func (p *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {

proxy/server.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type StatsRPC struct {
7575
// proxying request to given api.StatsProvider.
7676
func NewStatsRPC(stats adapter.StatsAPI) (*StatsRPC, error) {
7777
rpc := new(StatsRPC)
78-
if err := rpc.Connect(stats); err != nil {
78+
if err := rpc.connect(stats); err != nil {
7979
return nil, err
8080
}
8181
return rpc, nil
@@ -127,7 +127,7 @@ func (s *StatsRPC) watchConnection() {
127127
s.statsConn, err = core.ConnectStats(s.stats)
128128
if err == nil {
129129
atomic.StoreUint32(&s.available, 1)
130-
log.Println("enabling statsRPC service")
130+
log.Debugln("enabling statsRPC service")
131131
break
132132
}
133133
time.Sleep(5 * time.Second)
@@ -144,7 +144,7 @@ func (s *StatsRPC) watchConnection() {
144144
}
145145
}
146146

147-
func (s *StatsRPC) Connect(stats adapter.StatsAPI) error {
147+
func (s *StatsRPC) connect(stats adapter.StatsAPI) error {
148148
if atomic.LoadUint32(&s.isConnected) == 1 {
149149
return errors.New("connection already exists")
150150
}
@@ -161,7 +161,7 @@ func (s *StatsRPC) Connect(stats adapter.StatsAPI) error {
161161
return nil
162162
}
163163

164-
func (s *StatsRPC) Disconnect() {
164+
func (s *StatsRPC) disconnect() {
165165
if atomic.LoadUint32(&s.isConnected) == 1 {
166166
atomic.StoreUint32(&s.isConnected, 0)
167167
close(s.done)
@@ -243,7 +243,7 @@ type BinapiRPC struct {
243243
// proxying request to given api.Channel.
244244
func NewBinapiRPC(binapi adapter.VppAPI) (*BinapiRPC, error) {
245245
rpc := new(BinapiRPC)
246-
if err := rpc.Connect(binapi); err != nil {
246+
if err := rpc.connect(binapi); err != nil {
247247
return nil, err
248248
}
249249
return rpc, nil
@@ -290,7 +290,7 @@ func (s *BinapiRPC) watchConnection() {
290290
}
291291
}
292292

293-
func (s *BinapiRPC) Connect(binapi adapter.VppAPI) error {
293+
func (s *BinapiRPC) connect(binapi adapter.VppAPI) error {
294294
if atomic.LoadUint32(&s.isConnected) == 1 {
295295
return errors.New("connection already exists")
296296
}
@@ -307,7 +307,7 @@ func (s *BinapiRPC) Connect(binapi adapter.VppAPI) error {
307307
return nil
308308
}
309309

310-
func (s *BinapiRPC) Disconnect() {
310+
func (s *BinapiRPC) disconnect() {
311311
if atomic.LoadUint32(&s.isConnected) == 1 {
312312
atomic.StoreUint32(&s.isConnected, 0)
313313
close(s.done)

0 commit comments

Comments
 (0)