fix udp broken

pull/2348/head
FH0 2020-03-18 19:28:24 +08:00 committed by GitHub
parent fb0f05b159
commit 7651fb5586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -187,6 +187,15 @@ func (c *udpConn) Write(buf []byte) (int, error) {
return n, err
}
// Implements buf.ActivityNotifiable
func (c *udpConn) NotifyActivity() error {
if c.done.Done() {
return newError("connection is already closed")
}
c.updateActivity()
return nil
}
func (c *udpConn) Close() error {
common.Must(c.done.Close())
common.Must(common.Close(c.writer))