mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 13:17:36 +03:00
send out the CONNECTION_REFUSED error when refusing a connection (#4250)
So far, we used Connection.destroy, which destroys a connection without sending out a CONNECTION_CLOSE frame. This is useful (for example) when receiving a stateless reset, but it's not what we want when the server refuses an incoming connection. In this case, we want to send out a packet with a CONNECTION_CLOSE frame to inform the client that the connection attempt is being rejected.
This commit is contained in:
parent
b3eb375bc1
commit
cb1775a08a
7 changed files with 129 additions and 12 deletions
|
@ -12,6 +12,7 @@ import (
|
|||
reflect "reflect"
|
||||
|
||||
protocol "github.com/quic-go/quic-go/internal/protocol"
|
||||
qerr "github.com/quic-go/quic-go/internal/qerr"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
|
@ -38,6 +39,42 @@ func (m *MockPacketHandler) EXPECT() *MockPacketHandlerMockRecorder {
|
|||
return m.recorder
|
||||
}
|
||||
|
||||
// closeWithTransportError mocks base method.
|
||||
func (m *MockPacketHandler) closeWithTransportError(arg0 qerr.TransportErrorCode) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "closeWithTransportError", arg0)
|
||||
}
|
||||
|
||||
// closeWithTransportError indicates an expected call of closeWithTransportError.
|
||||
func (mr *MockPacketHandlerMockRecorder) closeWithTransportError(arg0 any) *PacketHandlercloseWithTransportErrorCall {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "closeWithTransportError", reflect.TypeOf((*MockPacketHandler)(nil).closeWithTransportError), arg0)
|
||||
return &PacketHandlercloseWithTransportErrorCall{Call: call}
|
||||
}
|
||||
|
||||
// PacketHandlercloseWithTransportErrorCall wrap *gomock.Call
|
||||
type PacketHandlercloseWithTransportErrorCall struct {
|
||||
*gomock.Call
|
||||
}
|
||||
|
||||
// Return rewrite *gomock.Call.Return
|
||||
func (c *PacketHandlercloseWithTransportErrorCall) Return() *PacketHandlercloseWithTransportErrorCall {
|
||||
c.Call = c.Call.Return()
|
||||
return c
|
||||
}
|
||||
|
||||
// Do rewrite *gomock.Call.Do
|
||||
func (c *PacketHandlercloseWithTransportErrorCall) Do(f func(qerr.TransportErrorCode)) *PacketHandlercloseWithTransportErrorCall {
|
||||
c.Call = c.Call.Do(f)
|
||||
return c
|
||||
}
|
||||
|
||||
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
||||
func (c *PacketHandlercloseWithTransportErrorCall) DoAndReturn(f func(qerr.TransportErrorCode)) *PacketHandlercloseWithTransportErrorCall {
|
||||
c.Call = c.Call.DoAndReturn(f)
|
||||
return c
|
||||
}
|
||||
|
||||
// destroy mocks base method.
|
||||
func (m *MockPacketHandler) destroy(arg0 error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue