From 8ea3c132362281c0635daea71dbabc8f07f74973 Mon Sep 17 00:00:00 2001 From: v2ray Date: Mon, 4 Jul 2016 14:17:42 +0200 Subject: [PATCH] rename ISegment -> Segment --- transport/internet/kcp/kcp.go | 2 +- transport/internet/kcp/output.go | 4 ++-- transport/internet/kcp/receiving.go | 2 +- transport/internet/kcp/segment.go | 4 ++-- transport/internet/kcp/sending.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/transport/internet/kcp/kcp.go b/transport/internet/kcp/kcp.go index 3e806f1e6..5673dc8ee 100644 --- a/transport/internet/kcp/kcp.go +++ b/transport/internet/kcp/kcp.go @@ -137,7 +137,7 @@ func (kcp *KCP) update_ack(rtt int32) { func (kcp *KCP) Input(data []byte) int { kcp.lastIncomingTime = kcp.current - var seg ISegment + var seg Segment for { seg, data = ReadSegment(data) if seg == nil { diff --git a/transport/internet/kcp/output.go b/transport/internet/kcp/output.go index 4970251af..4040969fa 100644 --- a/transport/internet/kcp/output.go +++ b/transport/internet/kcp/output.go @@ -9,7 +9,7 @@ import ( ) type SegmentWriter interface { - Write(seg ISegment) + Write(seg Segment) } type BufferedSegmentWriter struct { @@ -26,7 +26,7 @@ func NewSegmentWriter(writer *AuthenticationWriter) *BufferedSegmentWriter { } } -func (this *BufferedSegmentWriter) Write(seg ISegment) { +func (this *BufferedSegmentWriter) Write(seg Segment) { this.Lock() defer this.Unlock() diff --git a/transport/internet/kcp/receiving.go b/transport/internet/kcp/receiving.go index c23cf370c..4e08c4dfe 100644 --- a/transport/internet/kcp/receiving.go +++ b/transport/internet/kcp/receiving.go @@ -291,7 +291,7 @@ func (this *ReceivingWorker) Flush() { this.acklist.Flush(this.kcp.current, this.kcp.rx_rto) } -func (this *ReceivingWorker) Write(seg ISegment) { +func (this *ReceivingWorker) Write(seg Segment) { ackSeg := seg.(*AckSegment) ackSeg.Conv = this.kcp.conv ackSeg.ReceivingNext = this.nextNumber diff --git a/transport/internet/kcp/segment.go b/transport/internet/kcp/segment.go index 08fc7d8bd..3c5c81441 100644 --- a/transport/internet/kcp/segment.go +++ b/transport/internet/kcp/segment.go @@ -22,7 +22,7 @@ const ( SegmentOptionClose SegmentOption = 1 ) -type ISegment interface { +type Segment interface { common.Releasable ByteSize() int Bytes([]byte) []byte @@ -115,7 +115,7 @@ func (this *CmdOnlySegment) Bytes(b []byte) []byte { func (this *CmdOnlySegment) Release() {} -func ReadSegment(buf []byte) (ISegment, []byte) { +func ReadSegment(buf []byte) (Segment, []byte) { if len(buf) <= 4 { return nil, nil } diff --git a/transport/internet/kcp/sending.go b/transport/internet/kcp/sending.go index e08bfeb45..3468fd875 100644 --- a/transport/internet/kcp/sending.go +++ b/transport/internet/kcp/sending.go @@ -316,7 +316,7 @@ func (this *SendingWorker) Push(b []byte) int { return nBytes } -func (this *SendingWorker) Write(seg ISegment) { +func (this *SendingWorker) Write(seg Segment) { dataSeg := seg.(*DataSegment) dataSeg.Conv = this.kcp.conv