From 58dd6ddf93e621275ba9faf46f2a157dacbadccc Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 29 Jun 2015 19:37:52 +1000 Subject: [PATCH] Implement Stringer on connection --- connection.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/connection.go b/connection.go index c4f8b165..471d3f59 100644 --- a/connection.go +++ b/connection.go @@ -2,6 +2,7 @@ package torrent import ( "bufio" + "bytes" "container/list" "encoding" "errors" @@ -234,6 +235,12 @@ func (cn *connection) statusFlags() (ret string) { return } +func (cn *connection) String() string { + var buf bytes.Buffer + cn.WriteStatus(&buf, nil) + return buf.String() +} + func (cn *connection) WriteStatus(w io.Writer, t *torrent) { // \t isn't preserved in
 blocks?
 	fmt.Fprintf(w, "%+q: %s-%s\n", cn.PeerID, cn.localAddr(), cn.remoteAddr())