mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-08-09 19:01:47 +00:00
chore: code adjustments
This commit is contained in:
@@ -133,14 +133,19 @@ func (c *clientImpl) connect() error {
|
||||
c.conn = conn
|
||||
if udpEnabled {
|
||||
c.udpSM = newUDPSessionManager(&udpIOImpl{Conn: conn})
|
||||
go func() {
|
||||
c.udpSM.Run()
|
||||
// TODO: Mark connection as closed
|
||||
}()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// openStream wraps the stream with QStream, which handles Close() properly
|
||||
func (c *clientImpl) openStream() (quic.Stream, error) {
|
||||
stream, err := c.conn.OpenStream()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &utils.QStream{Stream: stream}, nil
|
||||
}
|
||||
|
||||
func (c *clientImpl) DialTCP(addr string) (net.Conn, error) {
|
||||
stream, err := c.openStream()
|
||||
if err != nil {
|
||||
@@ -272,12 +277,3 @@ func (io *udpIOImpl) SendMessage(buf []byte, msg *protocol.UDPMessage) error {
|
||||
}
|
||||
return io.Conn.SendMessage(buf[:msgN])
|
||||
}
|
||||
|
||||
// openStream wraps the stream with QStream, which handles Close() properly
|
||||
func (c *clientImpl) openStream() (quic.Stream, error) {
|
||||
stream, err := c.conn.OpenStream()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &utils.QStream{Stream: stream}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user