mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-12 11:49:55 +00:00
chore: remove an unnecessary variable
This commit is contained in:
@@ -42,7 +42,6 @@ type websocketWithEarlyDataConn struct {
|
|||||||
net.Conn
|
net.Conn
|
||||||
wsWriter N.ExtendedWriter
|
wsWriter N.ExtendedWriter
|
||||||
underlay net.Conn
|
underlay net.Conn
|
||||||
closed bool
|
|
||||||
dialed chan bool
|
dialed chan bool
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
@@ -204,7 +203,7 @@ func (wsedc *websocketWithEarlyDataConn) Dial(earlyData []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (wsedc *websocketWithEarlyDataConn) Write(b []byte) (int, error) {
|
func (wsedc *websocketWithEarlyDataConn) Write(b []byte) (int, error) {
|
||||||
if wsedc.closed {
|
if wsedc.ctx.Err() != nil {
|
||||||
return 0, io.ErrClosedPipe
|
return 0, io.ErrClosedPipe
|
||||||
}
|
}
|
||||||
if wsedc.Conn == nil {
|
if wsedc.Conn == nil {
|
||||||
@@ -218,7 +217,7 @@ func (wsedc *websocketWithEarlyDataConn) Write(b []byte) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (wsedc *websocketWithEarlyDataConn) WriteBuffer(buffer *buf.Buffer) error {
|
func (wsedc *websocketWithEarlyDataConn) WriteBuffer(buffer *buf.Buffer) error {
|
||||||
if wsedc.closed {
|
if wsedc.ctx.Err() != nil {
|
||||||
return io.ErrClosedPipe
|
return io.ErrClosedPipe
|
||||||
}
|
}
|
||||||
if wsedc.Conn == nil {
|
if wsedc.Conn == nil {
|
||||||
@@ -232,7 +231,7 @@ func (wsedc *websocketWithEarlyDataConn) WriteBuffer(buffer *buf.Buffer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (wsedc *websocketWithEarlyDataConn) Read(b []byte) (int, error) {
|
func (wsedc *websocketWithEarlyDataConn) Read(b []byte) (int, error) {
|
||||||
if wsedc.closed {
|
if wsedc.ctx.Err() != nil {
|
||||||
return 0, io.ErrClosedPipe
|
return 0, io.ErrClosedPipe
|
||||||
}
|
}
|
||||||
if wsedc.Conn == nil {
|
if wsedc.Conn == nil {
|
||||||
@@ -246,7 +245,6 @@ func (wsedc *websocketWithEarlyDataConn) Read(b []byte) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (wsedc *websocketWithEarlyDataConn) Close() error {
|
func (wsedc *websocketWithEarlyDataConn) Close() error {
|
||||||
wsedc.closed = true
|
|
||||||
wsedc.cancel()
|
wsedc.cancel()
|
||||||
if wsedc.Conn == nil { // is dialing or not dialed
|
if wsedc.Conn == nil { // is dialing or not dialed
|
||||||
return wsedc.underlay.Close()
|
return wsedc.underlay.Close()
|
||||||
|
|||||||
Reference in New Issue
Block a user