Merge branch 'v2fly-master' into v2ray-master

pull/2728/head
loyalsoldier 4 years ago
commit 811f0dd647
No known key found for this signature in database
GPG Key ID: 23829BBC1ACF2C90

@ -5,11 +5,15 @@ on:
branches: [master]
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
jobs:
test:

@ -126,6 +126,18 @@ func (m *Manager) RegisterCounter(name string) (stats.Counter, error) {
return c, nil
}
// UnregisterCounter implements stats.Manager.
func (m *Manager) UnregisterCounter(name string) error {
m.access.Lock()
defer m.access.Unlock()
if _, found := m.counters[name]; found {
newError("remove counter ", name).AtDebug().WriteToLog()
delete(m.counters, name)
}
return nil
}
// GetCounter implements stats.Manager.
func (m *Manager) GetCounter(name string) stats.Counter {
m.access.RLock()
@ -164,6 +176,18 @@ func (m *Manager) RegisterChannel(name string) (stats.Channel, error) {
return c, nil
}
// UnregisterChannel implements stats.Manager.
func (m *Manager) UnregisterChannel(name string) error {
m.access.Lock()
defer m.access.Unlock()
if _, found := m.channels[name]; found {
newError("remove channel ", name).AtDebug().WriteToLog()
delete(m.channels, name)
}
return nil
}
// GetChannel implements stats.Manager.
func (m *Manager) GetChannel(name string) stats.Channel {
m.access.RLock()

@ -38,12 +38,15 @@ type Manager interface {
// RegisterCounter registers a new counter to the manager. The identifier string must not be empty, and unique among other counters.
RegisterCounter(string) (Counter, error)
// UnregisterCounter unregisters a counter from the manager by its identifier.
UnregisterCounter(string) error
// GetCounter returns a counter by its identifier.
GetCounter(string) Counter
// RegisterChannel registers a new channel to the manager. The identifier string must not be empty, and unique among other channels.
RegisterChannel(string) (Channel, error)
// UnregisterCounter unregisters a channel from the manager by its identifier.
UnregisterChannel(string) error
// GetChannel returns a channel by its identifier.
GetChannel(string) Channel
}
@ -90,7 +93,7 @@ func (NoopManager) RegisterCounter(string) (Counter, error) {
// UnregisterCounter implements Manager.
func (NoopManager) UnregisterCounter(string) error {
return newError("not implemented")
return nil
}
// GetCounter implements Manager.
@ -103,6 +106,11 @@ func (NoopManager) RegisterChannel(string) (Channel, error) {
return nil, newError("not implemented")
}
// UnregisterChannel implements Manager.
func (NoopManager) UnregisterChannel(string) error {
return nil
}
// GetChannel implements Manager.
func (NoopManager) GetChannel(string) Channel {
return nil

@ -18,7 +18,7 @@ require (
golang.org/x/net v0.0.0-20200822124328-c89045814202
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a
google.golang.org/grpc v1.31.1
google.golang.org/grpc v1.32.0
google.golang.org/protobuf v1.25.0
h12.io/socks v1.0.1
)

@ -116,6 +116,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.31.1 h1:SfXqXS5hkufcdZ/mHtYCh53P2b+92WQq/DZcKLgsFRs=
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.32.0 h1:zWTV+LMdc3kaiJMSTOFz2UgSBgx8RNQoTGiZu3fR9S0=
google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=

Loading…
Cancel
Save