Skip to content

Commit

Permalink
expose NewConn and Server publicly
Browse files Browse the repository at this point in the history
  • Loading branch information
AJ ONeal committed Jul 10, 2015
1 parent 3895b50 commit 1a30898
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pkg/net/http/server.go
Expand Up @@ -172,7 +172,7 @@ func (w *response) ReadFrom(src io.Reader) (n int64, err error) {
const noLimit int64 = (1 << 63) - 1

// Create new connection from rwc.
func (srv *Server) newConn(rwc net.Conn) (c *conn, err error) {
func (srv *Server) NewConn(rwc net.Conn) (c *conn, err error) {
c = new(conn)
c.remoteAddr = rwc.RemoteAddr().String()
c.server = srv
Expand Down Expand Up @@ -564,7 +564,7 @@ func (c *conn) close() {
}

// Serve a new connection.
func (c *conn) serve() {
func (c *conn) Serve() {
defer func() {
err := recover()
if err == nil {
Expand Down Expand Up @@ -1033,11 +1033,11 @@ func (srv *Server) Serve(l net.Listener) error {
if srv.WriteTimeout != 0 {
rw.SetWriteDeadline(time.Now().Add(srv.WriteTimeout))
}
c, err := srv.newConn(rw)
c, err := srv.NewConn(rw)
if err != nil {
continue
}
go c.serve()
go c.Serve()
}
panic("not reached")
}
Expand Down

0 comments on commit 1a30898

Please sign in to comment.