Skip to content

Commit ad674a3

Browse files
committed
squash bugs, finish http tracker tests
1 parent 8fe5368 commit ad674a3

File tree

11 files changed

+466
-612
lines changed

11 files changed

+466
-612
lines changed

cmd/http_test_.go

Lines changed: 0 additions & 137 deletions
This file was deleted.

config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ type Configuration struct {
5959
type Warnings int
6060

6161
const (
62-
WarningNone Warnings = iota
63-
WarningUDPValidation Warnings = 1 << iota
64-
WarningPeerExpiry Warnings = 1 << iota
62+
WarningNone Warnings = 1 << iota
63+
WarningUDPValidation
64+
WarningPeerExpiry
6565
)
6666

6767
// Validate ensures that configuration values are sane and returns warnings for potential misconfigurations or security issues

refactoring.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
## Current
66

77
* Refactor HTTP tracker tests based on udp tracker tests
8+
* Add UDP tracker scrape tests
89

910
## Future
1011

storage/inmemory/hash.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55

66
"github.com/crimist/trakx/pools"
77
"github.com/crimist/trakx/storage"
8-
"github.com/crimist/trakx/utils"
98
)
109

1110
func (db *InMemory) TorrentStats(hash storage.Hash) (seeds, leeches uint16) {
@@ -51,16 +50,14 @@ func (db *InMemory) TorrentPeers(hash storage.Hash, numWant uint, includePeerID
5150
torrent.mutex.RLock()
5251
for id, peer := range torrent.Peers {
5352
if includePeerID {
54-
dictionary.String("peer id", utils.BytesToStringUnsafe(id[:]))
53+
dictionary.String("peer id", string(id[:]))
5554
}
5655
dictionary.String("ip", peer.IP.String())
5756
dictionary.Int64("port", int64(peer.Port))
5857

59-
// peers[i] = make([]byte, len(data))
60-
// copy(peers[i], data)
61-
// TODO: test this
62-
peers[i] = dictionary.GetBytes()
63-
58+
dictBytes := dictionary.GetBytes()
59+
peers[i] = make([]byte, len(dictBytes))
60+
copy(peers[i], dictBytes)
6461
dictionary.Reset()
6562

6663
i++

tracker/http/announce_bench_test.go

Lines changed: 0 additions & 175 deletions
This file was deleted.

0 commit comments

Comments
 (0)