Remove network.upstream

This is an artifact from when we used locks. No need for this anymore.
This commit is contained in:
Simon Ser 2020-04-30 10:25:16 +02:00
parent c4655f1492
commit e7e4311160
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
3 changed files with 6 additions and 11 deletions

View File

@ -134,7 +134,7 @@ func (dc *downstreamConn) upstream() *upstreamConn {
if dc.network == nil { if dc.network == nil {
return nil return nil
} }
return dc.network.upstream() return dc.network.conn
} }
func isOurNick(net *network, nick string) bool { func isOurNick(net *network, nick string) bool {

View File

@ -245,7 +245,7 @@ func handleServiceNetworkStatus(dc *downstreamConn, params []string) error {
dc.user.forEachNetwork(func(net *network) { dc.user.forEachNetwork(func(net *network) {
var statuses []string var statuses []string
var details string var details string
if uc := net.upstream(); uc != nil { if uc := net.conn; uc != nil {
if dc.nick != uc.nick { if dc.nick != uc.nick {
statuses = append(statuses, "connected as "+uc.nick) statuses = append(statuses, "connected as "+uc.nick)
} else { } else {

13
user.go
View File

@ -129,10 +129,6 @@ func (net *network) run() {
} }
} }
func (net *network) upstream() *upstreamConn {
return net.conn
}
func (net *network) Stop() { func (net *network) Stop() {
select { select {
case <-net.stopped: case <-net.stopped:
@ -141,8 +137,8 @@ func (net *network) Stop() {
close(net.stopped) close(net.stopped)
} }
if uc := net.upstream(); uc != nil { if net.conn != nil {
uc.Close() net.conn.Close()
} }
} }
@ -200,11 +196,10 @@ func (u *user) forEachNetwork(f func(*network)) {
func (u *user) forEachUpstream(f func(uc *upstreamConn)) { func (u *user) forEachUpstream(f func(uc *upstreamConn)) {
for _, network := range u.networks { for _, network := range u.networks {
uc := network.upstream() if network.conn == nil {
if uc == nil {
continue continue
} }
f(uc) f(network.conn)
} }
} }