Golang net/textproto.Pipeline type and EndRequest() function example

package net/textproto

Golang net/textproto.Pipeline type and EndRequest() function usage example

From http://golang.org/src/net/http/httputil/persist.go

 id := sc.pipe.Next()
 sc.pipe.StartRequest(id)
 defer func() {
 sc.pipe.EndRequest(id)
 if req == nil {
 sc.pipe.StartResponse(id)
 sc.pipe.EndResponse(id)
 } else {
 // Remember the pipeline id of this request
 sc.lk.Lock()
 sc.pipereq[req] = id
 return ErrPipeline
 }

References :

http://golang.org/pkg/net/textproto/#Pipeline

http://golang.org/pkg/net/textproto/#Pipeline.EndRequest

http://golang.org/src/net/http/httputil/persist.go

Advertisement