func (s *ResponseStream) Close() error { defer common.Recover() s.Lock() s.shutdownOnce.Do(s.shutdown) s.Unlock() return nil }
func (p *PushStream) Close() error { defer common.Recover() p.Lock() p.shutdownOnce.Do(p.shutdown) p.Unlock() return nil }
func serveSPDYNoNPN(conn net.Conn, srv *http.Server, version, subversion int) { defer common.Recover() tlsConn, ok := conn.(*tls.Conn) if !ok { // Only allow TLS connections. return } if d := srv.ReadTimeout; d != 0 { conn.SetReadDeadline(time.Now().Add(d)) } if d := srv.WriteTimeout; d != 0 { conn.SetWriteDeadline(time.Now().Add(d)) } if err := tlsConn.Handshake(); err != nil { return } serverConn, err := NewServerConn(tlsConn, srv, version, subversion) if err != nil { log.Println(err) return } serverConn.Run() }
func serveSPDY(conn net.Conn, srv *http.Server) { defer common.Recover() tlsConn, ok := conn.(*tls.Conn) if !ok { // Only allow TLS connections. return } if d := srv.ReadTimeout; d != 0 { conn.SetReadDeadline(time.Now().Add(d)) } if d := srv.WriteTimeout; d != 0 { conn.SetWriteDeadline(time.Now().Add(d)) } if err := tlsConn.Handshake(); err != nil { return } tlsState := new(tls.ConnectionState) *tlsState = tlsConn.ConnectionState() proto := tlsState.NegotiatedProtocol if fn := srv.TLSNextProto[proto]; fn != nil { fn(srv, tlsConn, nil) } return }
func (c *Conn) Run() error { defer common.Recover() go c.send() // Start the send loop. if c.init != nil { // Must be after sending is enabled. c.init() // Prepare any initialisation frames. } go c.readFrames() // Start the main loop. <-c.stop // Run until the connection ends. return nil }
func (s *RequestStream) processFrames() { defer common.Recover() for f := range s.headerChan { f() } }