mirror of
https://github.com/kataras/iris.git
synced 2026-01-07 20:17:05 +00:00
Former-commit-id: 5f55201d9f494efd3f2f4d92231ad8f271ce94e6
This commit is contained in:
@@ -2,6 +2,7 @@ package websocket
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -580,7 +581,14 @@ func (c *connection) Wait() {
|
|||||||
c.startReader()
|
c.startReader()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ErrAlreadyDisconnected can be reported on the `Connection#Disconnect` function whenever the caller tries to close the
|
||||||
|
// connection when it is already closed by the client or the caller previously.
|
||||||
|
var ErrAlreadyDisconnected = errors.New("already disconnected")
|
||||||
|
|
||||||
func (c *connection) Disconnect() error {
|
func (c *connection) Disconnect() error {
|
||||||
|
if c == nil || c.disconnected {
|
||||||
|
return ErrAlreadyDisconnected
|
||||||
|
}
|
||||||
return c.server.Disconnect(c.ID())
|
return c.server.Disconnect(c.ID())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user