]> Sergey Matveev's repositories - btrtrc.git/commitdiff
torrentfs: fix panic when testPeer is not specified
authorctn <costinc@gmail.com>
Tue, 26 Jul 2016 20:30:40 +0000 (23:30 +0300)
committerctn <costinc@gmail.com>
Tue, 26 Jul 2016 20:30:40 +0000 (23:30 +0300)
cmd/torrentfs/main.go

index 13f7c18a28db51c918f709857192c60223c67cf8..b5fc23dc39533ffab2100f87ab182b3f61cacfd0 100644 (file)
@@ -137,12 +137,15 @@ func main() {
        resolveTestPeerAddr()
        fs := torrentfs.New(client)
        go exitSignalHandlers(fs)
-       go func() {
-               for {
-                       addTestPeer(client)
-                       time.Sleep(10 * time.Second)
-               }
-       }()
+
+       if testPeerAddr != nil {
+               go func() {
+                       for {
+                               addTestPeer(client)
+                               time.Sleep(10 * time.Second)
+                       }
+               }()
+       }
 
        if err := fusefs.Serve(conn, fs); err != nil {
                log.Fatal(err)