On client CloseWrite, do CloseWrite instead of Close for backend
Co-authored-by: Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
This commit is contained in:
parent
401b3afa3b
commit
b55be9fdea
25 changed files with 393 additions and 36 deletions
|
@ -6,14 +6,23 @@ import (
|
|||
|
||||
// Handler is the TCP Handlers interface
|
||||
type Handler interface {
|
||||
ServeTCP(conn net.Conn)
|
||||
ServeTCP(conn WriteCloser)
|
||||
}
|
||||
|
||||
// The HandlerFunc type is an adapter to allow the use of
|
||||
// ordinary functions as handlers.
|
||||
type HandlerFunc func(conn net.Conn)
|
||||
type HandlerFunc func(conn WriteCloser)
|
||||
|
||||
// ServeTCP serves tcp
|
||||
func (f HandlerFunc) ServeTCP(conn net.Conn) {
|
||||
func (f HandlerFunc) ServeTCP(conn WriteCloser) {
|
||||
f(conn)
|
||||
}
|
||||
|
||||
// WriteCloser describes a net.Conn with a CloseWrite method.
|
||||
type WriteCloser interface {
|
||||
net.Conn
|
||||
// CloseWrite on a network connection, indicates that the issuer of the call
|
||||
// has terminated sending on that connection.
|
||||
// It corresponds to sending a FIN packet.
|
||||
CloseWrite() error
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue