From: Matt Joiner Date: Wed, 25 Mar 2015 04:49:27 +0000 (+1100) Subject: Move ut_pex back into the "m" map X-Git-Tag: v1.0.0~1248 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=6da805d1b1fb4a7e7a73d7f9534dec0134580de4;p=btrtrc.git Move ut_pex back into the "m" map --- diff --git a/client.go b/client.go index b355486d..b6aad982 100644 --- a/client.go +++ b/client.go @@ -1210,9 +1210,14 @@ func (me *Client) sendInitialMessages(conn *connection, torrent *torrent) { ExtendedID: pp.HandshakeExtendedID, ExtendedPayload: func() []byte { d := map[string]interface{}{ - "m": map[string]int{ - "ut_metadata": metadataExtendedId, - }, + "m": func() (ret map[string]int) { + ret = make(map[string]int, 2) + ret["ut_metadata"] = metadataExtendedId + if !me.config.DisablePEX { + ret["ut_pex"] = pexExtendedId + } + return + }(), "v": extendedHandshakeClientVersion, // No upload queue is implemented yet. "reqq": func() int { @@ -1225,9 +1230,6 @@ func (me *Client) sendInitialMessages(conn *connection, torrent *torrent) { }(), "e": 1, // Awwww yeah } - if !me.config.DisablePEX { - d["ut_pex"] = pexExtendedId - } if torrent.metadataSizeKnown() { d["metadata_size"] = torrent.metadataSize() }