Skip to content
This repository was archived by the owner on May 26, 2022. It is now read-only.

Commit 2736f3a

Browse files
authored
Merge pull request #18 from libp2p/fix/remove-notifier
fix: remove notifier
2 parents c50c291 + d33b7c1 commit 2736f3a

File tree

4 files changed

+0
-63
lines changed

4 files changed

+0
-63
lines changed

go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ require (
55
github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec // indirect
66
github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8
77
github.com/libp2p/go-nat v0.0.3
8-
github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f
98
)

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0
3434
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
3535
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo=
3636
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM=
37-
github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg=
38-
github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8=
3937
golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
4038
golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo=
4139
golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=

nat.go

-13
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ type NAT struct {
7474

7575
mappingmu sync.RWMutex // guards mappings
7676
mappings map[*mapping]struct{}
77-
78-
Notifier
7977
}
8078

8179
func newNAT(realNAT nat.NAT) *NAT {
@@ -186,10 +184,6 @@ func (nat *NAT) establishMapping(m *mapping) {
186184
m.setExternalPort(0) // clear mapping
187185
// TODO: log.Event
188186
log.Warningf("failed to establish port mapping: %s", err)
189-
nat.Notifier.notifyAll(func(n Notifiee) {
190-
n.MappingFailed(nat, m, oldport, err)
191-
})
192-
193187
// we do not close if the mapping failed,
194188
// because it may work again next time.
195189
return
@@ -199,12 +193,5 @@ func (nat *NAT) establishMapping(m *mapping) {
199193
log.Debugf("NAT Mapping: %s --> %s (%s)", m.ExternalPort(), m.InternalPort(), m.Protocol())
200194
if oldport != 0 && newport != oldport {
201195
log.Debugf("failed to renew same port mapping: ch %d -> %d", oldport, newport)
202-
nat.Notifier.notifyAll(func(n Notifiee) {
203-
n.MappingChanged(nat, m, oldport, newport)
204-
})
205196
}
206-
207-
nat.Notifier.notifyAll(func(n Notifiee) {
208-
n.MappingSuccess(nat, m)
209-
})
210197
}

notifier.go

-47
This file was deleted.

0 commit comments

Comments
 (0)