]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Simplify haveDhtServers()
authorYenForYang <YenForYang@users.noreply.github.com>
Fri, 3 Sep 2021 03:03:47 +0000 (22:03 -0500)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 3 Sep 2021 10:41:01 +0000 (20:41 +1000)
A bit too much functional programming, lol.

client.go

index b97c761492766549b98f3838e210f98df6bc821b..c5ab3373833527cb25eac53acbe900f47623d594 100644 (file)
--- a/client.go
+++ b/client.go
@@ -997,11 +997,8 @@ func (cl *Client) dhtPort() (ret uint16) {
        return
 }
 
-func (cl *Client) haveDhtServer() (ret bool) {
-       cl.eachDhtServer(func(_ DhtServer) {
-               ret = true
-       })
-       return
+func (cl *Client) haveDhtServer() bool {
+       return len(cl.dhtServers) > 0
 }
 
 // Process incoming ut_metadata message.