Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

timeoutConn is a ReaderTo and WriterFrom

  • Loading branch information...
commit 39f2d6a973b5bb88def959a31fa2d3c232f3c8dd 1 parent 0134720
@dustin dustin authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 timeout.go
View
9 timeout.go
@@ -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()
}
Please sign in to comment.
Something went wrong with that request. Please try again.