simplify the connection, rename it to sendConn

This commit is contained in:
Marten Seemann 2020-08-09 19:04:08 +07:00
parent d7c2169c55
commit 89417ab5ca
16 changed files with 175 additions and 246 deletions

View file

@ -17,7 +17,7 @@ import (
type client struct {
mutex sync.Mutex
conn connection
conn sendConn
// If the client is created with DialAddr, we create a packet conn.
// If it is started with Dial, we take a packet conn as a parameter.
createdPacketConn bool
@ -229,7 +229,7 @@ func newClient(
c := &client{
srcConnID: srcConnID,
destConnID: destConnID,
conn: &conn{pconn: pconn, currentAddr: remoteAddr},
conn: newSendConn(pconn, remoteAddr),
createdPacketConn: createdPacketConn,
use0RTT: use0RTT,
tlsConf: tlsConf,

View file

@ -35,7 +35,7 @@ var _ = Describe("Client", func() {
config *Config
originalClientSessConstructor func(
conn connection,
conn sendConn,
runner sessionRunner,
destConnID protocol.ConnectionID,
srcConnID protocol.ConnectionID,
@ -80,7 +80,7 @@ var _ = Describe("Client", func() {
srcConnID: connID,
destConnID: connID,
version: protocol.SupportedVersions[0],
conn: &conn{pconn: packetConn, currentAddr: addr},
conn: newSendConn(packetConn, addr),
tracer: tracer,
logger: utils.DefaultLogger,
}
@ -135,7 +135,7 @@ var _ = Describe("Client", func() {
remoteAddrChan := make(chan string, 1)
newClientSession = func(
conn connection,
conn sendConn,
_ sessionRunner,
_ protocol.ConnectionID,
_ protocol.ConnectionID,
@ -168,7 +168,7 @@ var _ = Describe("Client", func() {
hostnameChan := make(chan string, 1)
newClientSession = func(
_ connection,
_ sendConn,
_ sessionRunner,
_ protocol.ConnectionID,
_ protocol.ConnectionID,
@ -201,7 +201,7 @@ var _ = Describe("Client", func() {
hostnameChan := make(chan string, 1)
newClientSession = func(
_ connection,
_ sendConn,
_ sessionRunner,
_ protocol.ConnectionID,
_ protocol.ConnectionID,
@ -240,7 +240,7 @@ var _ = Describe("Client", func() {
run := make(chan struct{})
newClientSession = func(
_ connection,
_ sendConn,
runner sessionRunner,
_ protocol.ConnectionID,
_ protocol.ConnectionID,
@ -283,7 +283,7 @@ var _ = Describe("Client", func() {
readyChan := make(chan struct{})
done := make(chan struct{})
newClientSession = func(
_ connection,
_ sendConn,
runner sessionRunner,
_ protocol.ConnectionID,
_ protocol.ConnectionID,
@ -331,7 +331,7 @@ var _ = Describe("Client", func() {
testErr := errors.New("early handshake error")
newClientSession = func(
_ connection,
_ sendConn,
_ sessionRunner,
_ protocol.ConnectionID,
_ protocol.ConnectionID,
@ -375,7 +375,7 @@ var _ = Describe("Client", func() {
})
sess.EXPECT().HandshakeComplete().Return(context.Background())
newClientSession = func(
_ connection,
_ sendConn,
_ sessionRunner,
_ protocol.ConnectionID,
_ protocol.ConnectionID,
@ -422,12 +422,12 @@ var _ = Describe("Client", func() {
mockMultiplexer.EXPECT().AddConn(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(manager, nil)
manager.EXPECT().Add(gomock.Any(), gomock.Any())
var conn connection
var conn sendConn
run := make(chan struct{})
sessionCreated := make(chan struct{})
sess := NewMockQuicSession(mockCtrl)
newClientSession = func(
connP connection,
connP sendConn,
_ sessionRunner,
_ protocol.ConnectionID,
_ protocol.ConnectionID,
@ -544,11 +544,11 @@ var _ = Describe("Client", func() {
config := &Config{Versions: []protocol.VersionNumber{protocol.VersionTLS}}
c := make(chan struct{})
var cconn connection
var cconn sendConn
var version protocol.VersionNumber
var conf *Config
newClientSession = func(
connP connection,
connP sendConn,
_ sessionRunner,
_ protocol.ConnectionID,
_ protocol.ConnectionID,
@ -575,7 +575,7 @@ var _ = Describe("Client", func() {
_, err := Dial(packetConn, addr, "localhost:1337", tlsConf, config)
Expect(err).ToNot(HaveOccurred())
Eventually(c).Should(BeClosed())
Expect(cconn.(*conn).pconn).To(Equal(packetConn))
Expect(cconn.(*conn).PacketConn).To(Equal(packetConn))
Expect(version).To(Equal(config.Versions[0]))
Expect(conf.Versions).To(Equal(config.Versions))
})
@ -590,7 +590,7 @@ var _ = Describe("Client", func() {
var counter int
newClientSession = func(
_ connection,
_ sendConn,
_ sessionRunner,
_ protocol.ConnectionID,
_ protocol.ConnectionID,

View file

@ -11,7 +11,7 @@ import (
// When receiving packets for such a session, we need to retransmit the packet containing the CONNECTION_CLOSE frame,
// with an exponential backoff.
type closedLocalSession struct {
conn connection
conn sendConn
connClosePacket []byte
closeOnce sync.Once
@ -29,7 +29,7 @@ var _ packetHandler = &closedLocalSession{}
// newClosedLocalSession creates a new closedLocalSession and runs it.
func newClosedLocalSession(
conn connection,
conn sendConn,
connClosePacket []byte,
perspective protocol.Perspective,
logger utils.Logger,

View file

@ -15,11 +15,11 @@ import (
var _ = Describe("Closed local session", func() {
var (
sess packetHandler
mconn *MockConnection
mconn *MockSendConn
)
BeforeEach(func() {
mconn = NewMockConnection(mockCtrl)
mconn = NewMockSendConn(mockCtrl)
sess = newClosedLocalSession(mconn, []byte("close"), protocol.PerspectiveClient, utils.DefaultLogger)
})

54
conn.go
View file

@ -1,54 +0,0 @@
package quic
import (
"net"
"sync"
)
type connection interface {
Write([]byte) error
Read([]byte) (int, net.Addr, error)
Close() error
LocalAddr() net.Addr
RemoteAddr() net.Addr
SetCurrentRemoteAddr(net.Addr)
}
type conn struct {
mutex sync.RWMutex
pconn net.PacketConn
currentAddr net.Addr
}
var _ connection = &conn{}
func (c *conn) Write(p []byte) error {
_, err := c.pconn.WriteTo(p, c.currentAddr)
return err
}
func (c *conn) Read(p []byte) (int, net.Addr, error) {
return c.pconn.ReadFrom(p)
}
func (c *conn) SetCurrentRemoteAddr(addr net.Addr) {
c.mutex.Lock()
c.currentAddr = addr
c.mutex.Unlock()
}
func (c *conn) LocalAddr() net.Addr {
return c.pconn.LocalAddr()
}
func (c *conn) RemoteAddr() net.Addr {
c.mutex.RLock()
addr := c.currentAddr
c.mutex.RUnlock()
return addr
}
func (c *conn) Close() error {
return c.pconn.Close()
}

View file

@ -1,119 +0,0 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: Connection)
// Package quic is a generated GoMock package.
package quic
import (
net "net"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
)
// MockConnection is a mock of Connection interface
type MockConnection struct {
ctrl *gomock.Controller
recorder *MockConnectionMockRecorder
}
// MockConnectionMockRecorder is the mock recorder for MockConnection
type MockConnectionMockRecorder struct {
mock *MockConnection
}
// NewMockConnection creates a new mock instance
func NewMockConnection(ctrl *gomock.Controller) *MockConnection {
mock := &MockConnection{ctrl: ctrl}
mock.recorder = &MockConnectionMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockConnection) EXPECT() *MockConnectionMockRecorder {
return m.recorder
}
// Close mocks base method
func (m *MockConnection) Close() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close")
ret0, _ := ret[0].(error)
return ret0
}
// Close indicates an expected call of Close
func (mr *MockConnectionMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockConnection)(nil).Close))
}
// LocalAddr mocks base method
func (m *MockConnection) LocalAddr() net.Addr {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "LocalAddr")
ret0, _ := ret[0].(net.Addr)
return ret0
}
// LocalAddr indicates an expected call of LocalAddr
func (mr *MockConnectionMockRecorder) LocalAddr() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LocalAddr", reflect.TypeOf((*MockConnection)(nil).LocalAddr))
}
// Read mocks base method
func (m *MockConnection) Read(arg0 []byte) (int, net.Addr, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Read", arg0)
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(net.Addr)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
}
// Read indicates an expected call of Read
func (mr *MockConnectionMockRecorder) Read(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockConnection)(nil).Read), arg0)
}
// RemoteAddr mocks base method
func (m *MockConnection) RemoteAddr() net.Addr {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RemoteAddr")
ret0, _ := ret[0].(net.Addr)
return ret0
}
// RemoteAddr indicates an expected call of RemoteAddr
func (mr *MockConnectionMockRecorder) RemoteAddr() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoteAddr", reflect.TypeOf((*MockConnection)(nil).RemoteAddr))
}
// SetCurrentRemoteAddr mocks base method
func (m *MockConnection) SetCurrentRemoteAddr(arg0 net.Addr) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "SetCurrentRemoteAddr", arg0)
}
// SetCurrentRemoteAddr indicates an expected call of SetCurrentRemoteAddr
func (mr *MockConnectionMockRecorder) SetCurrentRemoteAddr(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCurrentRemoteAddr", reflect.TypeOf((*MockConnection)(nil).SetCurrentRemoteAddr), arg0)
}
// Write mocks base method
func (m *MockConnection) Write(arg0 []byte) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Write", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// Write indicates an expected call of Write
func (mr *MockConnectionMockRecorder) Write(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockConnection)(nil).Write), arg0)
}

91
mock_send_conn_test.go Normal file
View file

@ -0,0 +1,91 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: SendConn)
// Package quic is a generated GoMock package.
package quic
import (
net "net"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
)
// MockSendConn is a mock of SendConn interface
type MockSendConn struct {
ctrl *gomock.Controller
recorder *MockSendConnMockRecorder
}
// MockSendConnMockRecorder is the mock recorder for MockSendConn
type MockSendConnMockRecorder struct {
mock *MockSendConn
}
// NewMockSendConn creates a new mock instance
func NewMockSendConn(ctrl *gomock.Controller) *MockSendConn {
mock := &MockSendConn{ctrl: ctrl}
mock.recorder = &MockSendConnMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockSendConn) EXPECT() *MockSendConnMockRecorder {
return m.recorder
}
// Close mocks base method
func (m *MockSendConn) Close() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close")
ret0, _ := ret[0].(error)
return ret0
}
// Close indicates an expected call of Close
func (mr *MockSendConnMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockSendConn)(nil).Close))
}
// LocalAddr mocks base method
func (m *MockSendConn) LocalAddr() net.Addr {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "LocalAddr")
ret0, _ := ret[0].(net.Addr)
return ret0
}
// LocalAddr indicates an expected call of LocalAddr
func (mr *MockSendConnMockRecorder) LocalAddr() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LocalAddr", reflect.TypeOf((*MockSendConn)(nil).LocalAddr))
}
// RemoteAddr mocks base method
func (m *MockSendConn) RemoteAddr() net.Addr {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RemoteAddr")
ret0, _ := ret[0].(net.Addr)
return ret0
}
// RemoteAddr indicates an expected call of RemoteAddr
func (mr *MockSendConnMockRecorder) RemoteAddr() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoteAddr", reflect.TypeOf((*MockSendConn)(nil).RemoteAddr))
}
// Write mocks base method
func (m *MockSendConn) Write(arg0 []byte) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Write", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// Write indicates an expected call of Write
func (mr *MockSendConnMockRecorder) Write(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockSendConn)(nil).Write), arg0)
}

View file

@ -1,6 +1,6 @@
package quic
//go:generate sh -c "./mockgen_private.sh quic mock_connection_test.go github.com/lucas-clemente/quic-go connection"
//go:generate sh -c "./mockgen_private.sh quic mock_send_conn_test.go github.com/lucas-clemente/quic-go sendConn"
//go:generate sh -c "./mockgen_private.sh quic mock_stream_internal_test.go github.com/lucas-clemente/quic-go streamI"
//go:generate sh -c "./mockgen_private.sh quic mock_crypto_stream_test.go github.com/lucas-clemente/quic-go cryptoStream"
//go:generate sh -c "./mockgen_private.sh quic mock_receive_stream_internal_test.go github.com/lucas-clemente/quic-go receiveStreamI"

34
send_conn.go Normal file
View file

@ -0,0 +1,34 @@
package quic
import (
"net"
)
// A sendConn allows sending using a simple Write() on a non-connected packet conn.
type sendConn interface {
Write([]byte) error
Close() error
LocalAddr() net.Addr
RemoteAddr() net.Addr
}
type conn struct {
net.PacketConn
remoteAddr net.Addr
}
var _ sendConn = &conn{}
func newSendConn(c net.PacketConn, remote net.Addr) sendConn {
return &conn{PacketConn: c, remoteAddr: remote}
}
func (c *conn) Write(p []byte) error {
_, err := c.PacketConn.WriteTo(p, c.remoteAddr)
return err
}
func (c *conn) RemoteAddr() net.Addr {
return c.remoteAddr
}

View file

@ -66,8 +66,8 @@ func (c *mockPacketConn) SetWriteDeadline(t time.Time) error { panic("not implem
var _ net.PacketConn = &mockPacketConn{}
var _ = Describe("Connection", func() {
var c *conn
var _ = Describe("Send-Connection", func() {
var c sendConn
var packetConn *mockPacketConn
BeforeEach(func() {
@ -76,10 +76,7 @@ var _ = Describe("Connection", func() {
Port: 1337,
}
packetConn = newMockPacketConn()
c = &conn{
currentAddr: addr,
pconn: packetConn,
}
c = newSendConn(packetConn, addr)
})
It("writes", func() {
@ -90,17 +87,6 @@ var _ = Describe("Connection", func() {
Expect(write.data).To(Equal([]byte("foobar")))
})
It("reads", func() {
packetConn.dataToRead <- []byte("foo")
packetConn.dataReadFrom = &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 1336}
p := make([]byte, 10)
n, raddr, err := c.Read(p)
Expect(err).ToNot(HaveOccurred())
Expect(raddr.String()).To(Equal("127.0.0.1:1336"))
Expect(n).To(Equal(3))
Expect(p[0:3]).To(Equal([]byte("foo")))
})
It("gets the remote address", func() {
Expect(c.RemoteAddr().String()).To(Equal("192.168.100.200:1337"))
})
@ -114,15 +100,6 @@ var _ = Describe("Connection", func() {
Expect(c.LocalAddr()).To(Equal(addr))
})
It("changes the remote address", func() {
addr := &net.UDPAddr{
IP: net.IPv4(127, 0, 0, 1),
Port: 7331,
}
c.SetCurrentRemoteAddr(addr)
Expect(c.RemoteAddr().String()).To(Equal(addr.String()))
})
It("closes", func() {
err := c.Close()
Expect(err).ToNot(HaveOccurred())

View file

@ -4,10 +4,10 @@ type sendQueue struct {
queue chan *packetBuffer
closeCalled chan struct{} // runStopped when Close() is called
runStopped chan struct{} // runStopped when the run loop returns
conn connection
conn sendConn
}
func newSendQueue(conn connection) *sendQueue {
func newSendQueue(conn sendConn) *sendQueue {
s := &sendQueue{
conn: conn,
runStopped: make(chan struct{}),

View file

@ -10,10 +10,10 @@ import (
var _ = Describe("Send Queue", func() {
var q *sendQueue
var c *MockConnection
var c *MockSendConn
BeforeEach(func() {
c = NewMockConnection(mockCtrl)
c = NewMockSendConn(mockCtrl)
q = newSendQueue(c)
})

View file

@ -74,7 +74,7 @@ type baseServer struct {
// set as a member, so they can be set in the tests
newSession func(
connection,
sendConn,
sessionRunner,
protocol.ConnectionID, /* original dest connection ID */
*protocol.ConnectionID, /* retry src connection ID */
@ -471,7 +471,7 @@ func (s *baseServer) createNewSession(
tracer = s.config.Tracer.TracerForConnection(protocol.PerspectiveServer, connID)
}
sess = s.newSession(
&conn{pconn: s.conn, currentAddr: remoteAddr},
newSendConn(s.conn, remoteAddr),
s.sessionHandler,
origDestConnID,
retrySrcConnID,

View file

@ -324,7 +324,7 @@ var _ = Describe("Server", func() {
tracer.EXPECT().TracerForConnection(protocol.PerspectiveServer, protocol.ConnectionID{0xde, 0xad, 0xc0, 0xde})
sess := NewMockQuicSession(mockCtrl)
serv.newSession = func(
_ connection,
_ sendConn,
_ sessionRunner,
origDestConnID protocol.ConnectionID,
retrySrcConnID *protocol.ConnectionID,
@ -522,7 +522,7 @@ var _ = Describe("Server", func() {
sess := NewMockQuicSession(mockCtrl)
serv.newSession = func(
_ connection,
_ sendConn,
_ sessionRunner,
origDestConnID protocol.ConnectionID,
retrySrcConnID *protocol.ConnectionID,
@ -589,7 +589,7 @@ var _ = Describe("Server", func() {
sess.EXPECT().handlePacket(zeroRTTPacket),
)
serv.newSession = func(
_ connection,
_ sendConn,
runner sessionRunner,
_ protocol.ConnectionID,
_ *protocol.ConnectionID,
@ -634,7 +634,7 @@ var _ = Describe("Server", func() {
acceptSession := make(chan struct{})
var counter uint32 // to be used as an atomic, so we query it in Eventually
serv.newSession = func(
_ connection,
_ sendConn,
runner sessionRunner,
_ protocol.ConnectionID,
_ *protocol.ConnectionID,
@ -687,7 +687,7 @@ var _ = Describe("Server", func() {
var createdSession bool
sess := NewMockQuicSession(mockCtrl)
serv.newSession = func(
_ connection,
_ sendConn,
runner sessionRunner,
_ protocol.ConnectionID,
_ *protocol.ConnectionID,
@ -717,7 +717,7 @@ var _ = Describe("Server", func() {
serv.config.AcceptToken = func(_ net.Addr, _ *Token) bool { return true }
serv.newSession = func(
_ connection,
_ sendConn,
runner sessionRunner,
_ protocol.ConnectionID,
_ *protocol.ConnectionID,
@ -784,7 +784,7 @@ var _ = Describe("Server", func() {
sessionCreated := make(chan struct{})
sess := NewMockQuicSession(mockCtrl)
serv.newSession = func(
_ connection,
_ sendConn,
runner sessionRunner,
_ protocol.ConnectionID,
_ *protocol.ConnectionID,
@ -893,7 +893,7 @@ var _ = Describe("Server", func() {
ctx, cancel := context.WithCancel(context.Background()) // handshake context
serv.newSession = func(
_ connection,
_ sendConn,
runner sessionRunner,
_ protocol.ConnectionID,
_ *protocol.ConnectionID,
@ -961,7 +961,7 @@ var _ = Describe("Server", func() {
ready := make(chan struct{})
serv.newSession = func(
_ connection,
_ sendConn,
runner sessionRunner,
_ protocol.ConnectionID,
_ *protocol.ConnectionID,
@ -999,7 +999,7 @@ var _ = Describe("Server", func() {
senderAddr := &net.UDPAddr{IP: net.IPv4(1, 2, 3, 4), Port: 42}
serv.newSession = func(
_ connection,
_ sendConn,
runner sessionRunner,
_ protocol.ConnectionID,
_ *protocol.ConnectionID,
@ -1058,7 +1058,7 @@ var _ = Describe("Server", func() {
sessionCreated := make(chan struct{})
sess := NewMockQuicSession(mockCtrl)
serv.newSession = func(
_ connection,
_ sendConn,
runner sessionRunner,
_ protocol.ConnectionID,
_ *protocol.ConnectionID,

View file

@ -136,7 +136,7 @@ type session struct {
version protocol.VersionNumber
config *Config
conn connection
conn sendConn
sendQueue *sendQueue
streamsMap streamManager
@ -215,7 +215,7 @@ var _ EarlySession = &session{}
var _ streamSender = &session{}
var newSession = func(
conn connection,
conn sendConn,
runner sessionRunner,
origDestConnID protocol.ConnectionID,
retrySrcConnID *protocol.ConnectionID,
@ -342,7 +342,7 @@ var newSession = func(
// declare this as a variable, such that we can it mock it in the tests
var newClientSession = func(
conn connection,
conn sendConn,
runner sessionRunner,
destConnID protocol.ConnectionID,
srcConnID protocol.ConnectionID,

View file

@ -46,7 +46,7 @@ var _ = Describe("Session", func() {
var (
sess *session
sessionRunner *MockSessionRunner
mconn *MockConnection
mconn *MockSendConn
streamManager *MockStreamManager
packer *MockPacker
cryptoSetup *mocks.MockCryptoSetup
@ -83,7 +83,7 @@ var _ = Describe("Session", func() {
Eventually(areSessionsRunning).Should(BeFalse())
sessionRunner = NewMockSessionRunner(mockCtrl)
mconn = NewMockConnection(mockCtrl)
mconn = NewMockSendConn(mockCtrl)
mconn.EXPECT().RemoteAddr().Return(remoteAddr).AnyTimes()
mconn.EXPECT().LocalAddr().Return(localAddr).AnyTimes()
tokenGenerator, err := handshake.NewTokenGenerator()
@ -615,7 +615,7 @@ var _ = Describe("Session", func() {
It("closes when the sendQueue encounters an error", func() {
sess.handshakeConfirmed = true
conn := NewMockConnection(mockCtrl)
conn := NewMockSendConn(mockCtrl)
conn.EXPECT().Write(gomock.Any()).Return(io.ErrClosedPipe).AnyTimes()
sess.sendQueue = newSendQueue(conn)
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
@ -2107,7 +2107,7 @@ var _ = Describe("Client Session", func() {
sess *session
sessionRunner *MockSessionRunner
packer *MockPacker
mconn *MockConnection
mconn *MockSendConn
cryptoSetup *mocks.MockCryptoSetup
tracer *mocks.MockConnectionTracer
tlsConf *tls.Config
@ -2140,7 +2140,7 @@ var _ = Describe("Client Session", func() {
JustBeforeEach(func() {
Eventually(areSessionsRunning).Should(BeFalse())
mconn = NewMockConnection(mockCtrl)
mconn = NewMockSendConn(mockCtrl)
mconn.EXPECT().RemoteAddr().Return(&net.UDPAddr{}).Times(2)
mconn.EXPECT().LocalAddr().Return(&net.UDPAddr{})
if tlsConf == nil {