}
func (cn *connection) Post(msg pp.Message) {
- postedMessageTypes.Add(strconv.FormatInt(int64(msg.Type), 10), 1)
+ messageTypesPosted.Add(strconv.FormatInt(int64(msg.Type), 10), 1)
cn.postedBuffer.Write(msg.MustMarshalBinary())
cn.writerCond.Broadcast()
}
cn.postedBuffer.Reset()
if buf.Len() == 0 {
cn.fillWriteBuffer(func(msg pp.Message) bool {
+ cn.wroteMsg(&msg)
buf.Write(msg.MustMarshalBinary())
return buf.Len() < 1<<16
})
}
func (cn *connection) wroteMsg(msg *pp.Message) {
+ messageTypesSent.Add(strconv.FormatInt(int64(msg.Type), 10), 1)
cn.stats.wroteMsg(msg)
cn.t.stats.wroteMsg(msg)
}
receivedKeepalives.Add(1)
continue
}
- receivedMessageTypes.Add(strconv.FormatInt(int64(msg.Type), 10), 1)
+ messageTypesReceived.Add(strconv.FormatInt(int64(msg.Type), 10), 1)
switch msg.Type {
case pp.Choke:
c.PeerChoked = true
connsToSelf = expvar.NewInt("connsToSelf")
// Number of completed connections to a client we're already connected with.
duplicateClientConns = expvar.NewInt("duplicateClientConns")
- receivedMessageTypes = expvar.NewMap("receivedMessageTypes")
receivedKeepalives = expvar.NewInt("receivedKeepalives")
supportedExtensionMessages = expvar.NewMap("supportedExtensionMessages")
- postedMessageTypes = expvar.NewMap("postedMessageTypes")
postedKeepalives = expvar.NewInt("postedKeepalives")
// Requests received for pieces we don't have.
requestsReceivedForMissingPieces = expvar.NewInt("requestsReceivedForMissingPieces")
+ messageTypesReceived = expvar.NewMap("messageTypesReceived")
+ messageTypesSent = expvar.NewMap("messageTypesSent")
+ messageTypesPosted = expvar.NewMap("messageTypesPosted")
+
// Track the effectiveness of Torrent.connPieceInclinationPool.
pieceInclinationsReused = expvar.NewInt("pieceInclinationsReused")
pieceInclinationsNew = expvar.NewInt("pieceInclinationsNew")