mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 23:40:35 +01:00
Former-commit-id: 5f55201d9f494efd3f2f4d92231ad8f271ce94e6
This commit is contained in:
parent
b08df3a785
commit
21ab51bde7
|
@ -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())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user