Permalink
Browse files

timeoutConn is a ReaderTo and WriterFrom

  • Loading branch information...
1 parent 0134720 commit 39f2d6a973b5bb88def959a31fa2d3c232f3c8dd @dustin dustin committed Jul 6, 2013
Showing with 9 additions and 0 deletions.
  1. +9 −0 timeout.go
View
@@ -1,6 +1,7 @@
package main
import (
+ "io"
"net"
"net/http"
"time"
@@ -23,6 +24,14 @@ func (tc *timeoutConn) Write(b []byte) (n int, err error) {
return tc.socket.Write(b)
}
+func (tc *timeoutConn) ReadFrom(r io.Reader) (int64, error) {
+ return io.Copy(tc.socket, r)
+}
+
+func (tc *timeoutConn) WriteTo(w io.Writer) (int64, error) {
+ return io.Copy(w, tc.socket)
+}
+
func (tc *timeoutConn) Close() error {
return tc.socket.Close()
}

0 comments on commit 39f2d6a

Please sign in to comment.