mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 05:46:32 +00:00
These timeouts default to 'do not time out' if they are not set. This times up resources, potentially indefinitely. If node on the other side of the the handshake is up but unresponsive, the[ handshake call](edec79448a/internal/p2p/router.go (L720)) will _never_ return.
These are proposed values that have not been validated. I intend to validate them in a production setting.
170 lines
3.8 KiB
Go
170 lines
3.8 KiB
Go
// Code generated by mockery. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
context "context"
|
|
|
|
conn "github.com/tendermint/tendermint/internal/p2p/conn"
|
|
|
|
crypto "github.com/tendermint/tendermint/crypto"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
p2p "github.com/tendermint/tendermint/internal/p2p"
|
|
|
|
time "time"
|
|
|
|
types "github.com/tendermint/tendermint/types"
|
|
)
|
|
|
|
// Connection is an autogenerated mock type for the Connection type
|
|
type Connection struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Close provides a mock function with given fields:
|
|
func (_m *Connection) Close() error {
|
|
ret := _m.Called()
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func() error); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Handshake provides a mock function with given fields: _a0, _a1, _a2, _a3
|
|
func (_m *Connection) Handshake(_a0 context.Context, _a1 time.Duration, _a2 types.NodeInfo, _a3 crypto.PrivKey) (types.NodeInfo, crypto.PubKey, error) {
|
|
ret := _m.Called(_a0, _a1, _a2, _a3)
|
|
|
|
var r0 types.NodeInfo
|
|
if rf, ok := ret.Get(0).(func(context.Context, time.Duration, types.NodeInfo, crypto.PrivKey) types.NodeInfo); ok {
|
|
r0 = rf(_a0, _a1, _a2, _a3)
|
|
} else {
|
|
r0 = ret.Get(0).(types.NodeInfo)
|
|
}
|
|
|
|
var r1 crypto.PubKey
|
|
if rf, ok := ret.Get(1).(func(context.Context, time.Duration, types.NodeInfo, crypto.PrivKey) crypto.PubKey); ok {
|
|
r1 = rf(_a0, _a1, _a2, _a3)
|
|
} else {
|
|
if ret.Get(1) != nil {
|
|
r1 = ret.Get(1).(crypto.PubKey)
|
|
}
|
|
}
|
|
|
|
var r2 error
|
|
if rf, ok := ret.Get(2).(func(context.Context, time.Duration, types.NodeInfo, crypto.PrivKey) error); ok {
|
|
r2 = rf(_a0, _a1, _a2, _a3)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// LocalEndpoint provides a mock function with given fields:
|
|
func (_m *Connection) LocalEndpoint() p2p.Endpoint {
|
|
ret := _m.Called()
|
|
|
|
var r0 p2p.Endpoint
|
|
if rf, ok := ret.Get(0).(func() p2p.Endpoint); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(p2p.Endpoint)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// ReceiveMessage provides a mock function with given fields: _a0
|
|
func (_m *Connection) ReceiveMessage(_a0 context.Context) (conn.ChannelID, []byte, error) {
|
|
ret := _m.Called(_a0)
|
|
|
|
var r0 conn.ChannelID
|
|
if rf, ok := ret.Get(0).(func(context.Context) conn.ChannelID); ok {
|
|
r0 = rf(_a0)
|
|
} else {
|
|
r0 = ret.Get(0).(conn.ChannelID)
|
|
}
|
|
|
|
var r1 []byte
|
|
if rf, ok := ret.Get(1).(func(context.Context) []byte); ok {
|
|
r1 = rf(_a0)
|
|
} else {
|
|
if ret.Get(1) != nil {
|
|
r1 = ret.Get(1).([]byte)
|
|
}
|
|
}
|
|
|
|
var r2 error
|
|
if rf, ok := ret.Get(2).(func(context.Context) error); ok {
|
|
r2 = rf(_a0)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// RemoteEndpoint provides a mock function with given fields:
|
|
func (_m *Connection) RemoteEndpoint() p2p.Endpoint {
|
|
ret := _m.Called()
|
|
|
|
var r0 p2p.Endpoint
|
|
if rf, ok := ret.Get(0).(func() p2p.Endpoint); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(p2p.Endpoint)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// SendMessage provides a mock function with given fields: _a0, _a1, _a2
|
|
func (_m *Connection) SendMessage(_a0 context.Context, _a1 conn.ChannelID, _a2 []byte) error {
|
|
ret := _m.Called(_a0, _a1, _a2)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, conn.ChannelID, []byte) error); ok {
|
|
r0 = rf(_a0, _a1, _a2)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// String provides a mock function with given fields:
|
|
func (_m *Connection) String() string {
|
|
ret := _m.Called()
|
|
|
|
var r0 string
|
|
if rf, ok := ret.Get(0).(func() string); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
type NewConnectionT interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}
|
|
|
|
// NewConnection creates a new instance of Connection. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
func NewConnection(t NewConnectionT) *Connection {
|
|
mock := &Connection{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|