mirror of https://github.com/v2ray/v2ray-core
clean up after error
parent
c6df0fde19
commit
11c7191b38
|
@ -92,6 +92,7 @@ func ReadRequest(reader io.Reader, auth *Authenticator, udp bool) (*Request, err
|
||||||
nBytes, err := reader.Read(buffer.Value[lenBuffer:])
|
nBytes, err := reader.Read(buffer.Value[lenBuffer:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Shadowsocks: Failed to read UDP payload: ", err)
|
log.Error("Shadowsocks: Failed to read UDP payload: ", err)
|
||||||
|
return nil, transport.ErrorCorruptedPacket
|
||||||
}
|
}
|
||||||
buffer.Slice(0, lenBuffer+nBytes)
|
buffer.Slice(0, lenBuffer+nBytes)
|
||||||
if request.OTA {
|
if request.OTA {
|
||||||
|
|
|
@ -77,6 +77,7 @@ func (this *Shadowsocks) Listen(port v2net.Port) error {
|
||||||
udpHub, err := hub.ListenUDP(port, this.handlerUDPPayload)
|
udpHub, err := hub.ListenUDP(port, this.handlerUDPPayload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Shadowsocks: Failed to listen UDP on port ", port, ": ", err)
|
log.Error("Shadowsocks: Failed to listen UDP on port ", port, ": ", err)
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
this.udpHub = udpHub
|
this.udpHub = udpHub
|
||||||
this.udpServer = hub.NewUDPServer(this.packetDispatcher)
|
this.udpServer = hub.NewUDPServer(this.packetDispatcher)
|
||||||
|
|
Loading…
Reference in New Issue