mirror of
https://github.com/slackhq/nebula.git
synced 2026-05-16 04:47:38 +02:00
ReadBatch is named Read now
This commit is contained in:
@@ -27,19 +27,15 @@ type TestTun struct {
|
||||
rxPackets chan []byte // Packets to receive into nebula
|
||||
TxPackets chan []byte // Packets transmitted outside by nebula
|
||||
|
||||
readBuf []byte
|
||||
batchRet [1][]byte
|
||||
}
|
||||
|
||||
func (t *TestTun) ReadBatch() ([][]byte, error) {
|
||||
if t.readBuf == nil {
|
||||
t.readBuf = make([]byte, defaultBatchBufSize)
|
||||
func (t *TestTun) Read() ([][]byte, error) {
|
||||
p, ok := <-t.rxPackets
|
||||
if !ok {
|
||||
return nil, os.ErrClosed
|
||||
}
|
||||
n, err := t.Read(t.readBuf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
t.batchRet[0] = t.readBuf[:n]
|
||||
t.batchRet[0] = p
|
||||
return t.batchRet[:], nil
|
||||
}
|
||||
|
||||
@@ -142,15 +138,6 @@ func (t *TestTun) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *TestTun) Read(b []byte) (int, error) {
|
||||
p, ok := <-t.rxPackets
|
||||
if !ok {
|
||||
return 0, os.ErrClosed
|
||||
}
|
||||
copy(b, p)
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
func (t *TestTun) SupportsMultiqueue() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user