From e7e43111605bc578795335eeb686cc8c156adca0 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 30 Apr 2020 10:25:16 +0200 Subject: [PATCH] Remove network.upstream This is an artifact from when we used locks. No need for this anymore. --- downstream.go | 2 +- service.go | 2 +- user.go | 13 ++++--------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/downstream.go b/downstream.go index 9c28258..8697e15 100644 --- a/downstream.go +++ b/downstream.go @@ -134,7 +134,7 @@ func (dc *downstreamConn) upstream() *upstreamConn { if dc.network == nil { return nil } - return dc.network.upstream() + return dc.network.conn } func isOurNick(net *network, nick string) bool { diff --git a/service.go b/service.go index 11d1bfb..011d1a2 100644 --- a/service.go +++ b/service.go @@ -245,7 +245,7 @@ func handleServiceNetworkStatus(dc *downstreamConn, params []string) error { dc.user.forEachNetwork(func(net *network) { var statuses []string var details string - if uc := net.upstream(); uc != nil { + if uc := net.conn; uc != nil { if dc.nick != uc.nick { statuses = append(statuses, "connected as "+uc.nick) } else { diff --git a/user.go b/user.go index 508128c..56c2103 100644 --- a/user.go +++ b/user.go @@ -129,10 +129,6 @@ func (net *network) run() { } } -func (net *network) upstream() *upstreamConn { - return net.conn -} - func (net *network) Stop() { select { case <-net.stopped: @@ -141,8 +137,8 @@ func (net *network) Stop() { close(net.stopped) } - if uc := net.upstream(); uc != nil { - uc.Close() + if net.conn != nil { + net.conn.Close() } } @@ -200,11 +196,10 @@ func (u *user) forEachNetwork(f func(*network)) { func (u *user) forEachUpstream(f func(uc *upstreamConn)) { for _, network := range u.networks { - uc := network.upstream() - if uc == nil { + if network.conn == nil { continue } - f(uc) + f(network.conn) } }