1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-18 02:16:10 -05:00

leverage pool functions

This commit is contained in:
v2ray 2016-07-05 11:36:05 +02:00
parent 34fb72e7c6
commit 6efff7654c
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -186,10 +186,9 @@ func ReadSegment(buf []byte) (Segment, []byte) {
buf = buf[2:] buf = buf[2:]
if cmd == SegmentCommandData { if cmd == SegmentCommandData {
seg := &DataSegment{ seg := NewDataSegment()
Conv: conv, seg.Conv = conv
Opt: opt, seg.Opt = opt
}
if len(buf) < 16 { if len(buf) < 16 {
return nil, nil return nil, nil
} }
@ -215,10 +214,9 @@ func ReadSegment(buf []byte) (Segment, []byte) {
} }
if cmd == SegmentCommandACK { if cmd == SegmentCommandACK {
seg := &AckSegment{ seg := NewAckSegment()
Conv: conv, seg.Conv = conv
Opt: opt, seg.Opt = opt
}
if len(buf) < 9 { if len(buf) < 9 {
return nil, nil return nil, nil
} }
@ -247,11 +245,10 @@ func ReadSegment(buf []byte) (Segment, []byte) {
return seg, buf return seg, buf
} }
seg := &CmdOnlySegment{ seg := NewCmdOnlySegment()
Conv: conv, seg.Conv = conv
Cmd: cmd, seg.Cmd = cmd
Opt: opt, seg.Opt = opt
}
if len(buf) < 8 { if len(buf) < 8 {
return nil, nil return nil, nil