aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-07-18 01:21:47 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-07-18 01:21:47 +0200
commit857c4cae5f4a54952fd4ecf78235dac33e9f0405 (patch)
treeb2a124f2437f6a0704294ef4b4c27d181ad86e36
parent59e40ca90dc1a26e1e728bcaec29b061c8b07d87 (diff)
Cleanup
-rw-r--r--bencode/bencode_test.go4
-rw-r--r--cmd/btcheck/main.go4
-rw-r--r--meta/torrent.go3
-rw-r--r--tracker/messages.go10
4 files changed, 6 insertions, 15 deletions
diff --git a/bencode/bencode_test.go b/bencode/bencode_test.go
index 329baad..48c494d 100644
--- a/bencode/bencode_test.go
+++ b/bencode/bencode_test.go
@@ -104,7 +104,7 @@ func TestUnmarshalPartial(t *testing.T) {
func TestUnmarshalBool(t *testing.T) {
var b struct{ A bool }
in := `d1:Ai1ee`
- err := Unmarshal([]byte(in), &b)
+ _, err := Unmarshal([]byte(in), &b)
if err != nil {
t.Error(err)
}
@@ -116,7 +116,7 @@ func TestUnmarshalBool(t *testing.T) {
func TestUnmarshalInt64(t *testing.T) {
var b struct{ A int64 }
in := `d1:Ai42ee`
- err := Unmarshal([]byte(in), &b)
+ _, err := Unmarshal([]byte(in), &b)
if err != nil {
t.Error(err)
}
diff --git a/cmd/btcheck/main.go b/cmd/btcheck/main.go
index b054c8f..0bbd91d 100644
--- a/cmd/btcheck/main.go
+++ b/cmd/btcheck/main.go
@@ -42,6 +42,6 @@ func main() {
if err != nil {
log.Fatal(err)
}
- fmt.Println(resp.IntervalDuration())
- fmt.Println(resp.PeerAddr())
+ fmt.Println(resp.Interval)
+ fmt.Println(resp.Peers)
}
diff --git a/meta/torrent.go b/meta/torrent.go
index 41323a8..7f0ab7f 100644
--- a/meta/torrent.go
+++ b/meta/torrent.go
@@ -40,5 +40,6 @@ func New(fname string) (Torrent, error) {
if err != nil {
return Torrent{}, err
}
- return tor, bencode.Unmarshal(body, &tor)
+ _, err = bencode.Unmarshal(body, &tor)
+ return tor, err
}
diff --git a/tracker/messages.go b/tracker/messages.go
index b32dd8a..7dd4429 100644
--- a/tracker/messages.go
+++ b/tracker/messages.go
@@ -115,16 +115,6 @@ func (r Request) Get(announce string) (Response, error) {
return res, nil
}
-func (r Response) IntervalDuration() time.Duration {
- return time.Duration(r.Interval) * time.Second
-}
-
-/*
-func (r Response) PeerAddr() ([]*net.TCPAddr, error) {
- return peerAddr(r.Peers)
-}
-*/
-
func peerAddr(b []byte) ([]*net.TCPAddr, error) {
n := len(b) / 6
a := make([]*net.TCPAddr, n)