diff --git a/controller/handler_ctrl/create_terminator.go b/controller/handler_ctrl/create_terminator.go index a0fc02090..15dd98b8a 100644 --- a/controller/handler_ctrl/create_terminator.go +++ b/controller/handler_ctrl/create_terminator.go @@ -67,7 +67,7 @@ func (h *createTerminatorHandler) HandleReceive(msg *channel2.Message, ch channe Cost: uint16(request.Cost), } - if id, err := h.network.CreateTerminator(terminator, request.ExtensionData); err == nil { + if id, err := h.network.Terminators.Create(terminator); err == nil { pfxlog.Logger().Infof("created terminator [t/%s]", id) handler_common.SendSuccess(msg, ch, id) } else { diff --git a/controller/network/network.go b/controller/network/network.go index d74f0356c..b78fcb976 100644 --- a/controller/network/network.go +++ b/controller/network/network.go @@ -64,7 +64,6 @@ type Network struct { lastSnapshot time.Time metricsRegistry metrics.Registry VersionProvider common.VersionProvider - xvalidators } func NewNetwork(nodeId *identity.TokenId, options *Options, database boltz.Db, metricsCfg *metrics.Config, versionProvider common.VersionProvider) (*Network, error) { @@ -92,10 +91,6 @@ func NewNetwork(nodeId *identity.TokenId, options *Options, database boltz.Db, m lastSnapshot: time.Now().Add(-time.Hour), metricsRegistry: metrics.NewRegistry(nodeId.Token, nil), VersionProvider: versionProvider, - xvalidators: xvalidators{ - newSessionValidators: ©OnWriteNewSessionValidatorMap{}, - newTerminatorValidators: ©OnWriteNewTerminatorValidatorMap{}, - }, } metrics.Init(metricsCfg) events.AddMetricsEventHandler(network) @@ -285,7 +280,7 @@ func (network *Network) LinkChanged(l *Link) { }() } -func (network *Network) CreateSession(srcR *Router, clientId *identity.TokenId, service string, extensionData map[string][]byte) (*session, error) { +func (network *Network) CreateSession(srcR *Router, clientId *identity.TokenId, service string) (*session, error) { log := pfxlog.Logger() // 1: Allocate Session Identifier @@ -305,24 +300,13 @@ func (network *Network) CreateSession(srcR *Router, clientId *identity.TokenId, return nil, err } - // 3: Allow validastion extensions to get plugged in - for id, data := range extensionData { - validator := network.xvalidators.newSessionValidators.get(id) - if validator == nil { - return nil, errors.Errorf("no session validator of type '%v'", id) - } - if err := validator.ValidateSession(srcR, clientId, svc, data); err != nil { - return nil, err - } - } - - // 4: select terminator + // 3: select terminator strategy, terminator, path, err := network.selectPath(srcR, svc, targetIdentity) if err != nil { return nil, err } - // 5: Create Circuit + // 4: Create Circuit circuit, err := network.CreateCircuitWithPath(path) if err != nil { return nil, err @@ -336,13 +320,13 @@ func (network *Network) CreateSession(srcR *Router, clientId *identity.TokenId, circuit.Binding = "udp" } - // 5a: Create Route Messages + // 4a: Create Route Messages rms, err := circuit.CreateRouteMessages(sessionId, terminator.GetAddress()) if err != nil { return nil, err } - // 6: Route Egress + // 5: Route Egress rms[len(rms)-1].Egress.PeerData = clientId.Data peerData, err := sendRoute(circuit.Path[len(circuit.Path)-1], rms[len(rms)-1], network.options.TerminationTimeout) if err != nil { @@ -357,7 +341,7 @@ func (network *Network) CreateSession(srcR *Router, clientId *identity.TokenId, strategy.NotifyEvent(xt.NewDialSucceeded(terminator)) } - // 7: Create Intermediate Routes + // 6: Create Intermediate Routes for i := 0; i < len(circuit.Path)-1; i++ { _, err = sendRoute(circuit.Path[i], rms[i], network.options.RouteTimeout) if err != nil { @@ -365,7 +349,7 @@ func (network *Network) CreateSession(srcR *Router, clientId *identity.TokenId, } } - // 8: Create Session Object + // 7: Create Session Object ss := &session{ Id: sessionId, ClientId: clientId, @@ -833,27 +817,6 @@ func (network *Network) SnapshotDatabase() error { return err } -func (network *Network) RegisterNewSessionValidator(id string, v NewSessionValidator) { - network.xvalidators.newSessionValidators.put(id, v) -} - -func (network *Network) RegisterNewTerminatorValidator(id string, v NewTerminatorValidator) { - network.xvalidators.newTerminatorValidators.put(id, v) -} - -func (network *Network) CreateTerminator(t *Terminator, extensionData map[string][]byte) (string, error) { - for id, data := range extensionData { - validator := network.xvalidators.newTerminatorValidators.get(id) - if validator == nil { - return "", errors.Errorf("no terminator validator of type '%v'", id) - } - if err := validator.ValidateTerminator(t, data); err != nil { - return "", err - } - } - return network.Terminators.Create(t) -} - type Cache interface { RemoveFromCache(id string) } diff --git a/controller/network/xvalidation.go b/controller/network/xvalidation.go deleted file mode 100644 index 3ada847ef..000000000 --- a/controller/network/xvalidation.go +++ /dev/null @@ -1,66 +0,0 @@ -package network - -import ( - "github.com/openziti/foundation/identity/identity" - "sync" - "sync/atomic" -) - -type xvalidators struct { - newSessionValidators *copyOnWriteNewSessionValidatorMap - newTerminatorValidators *copyOnWriteNewTerminatorValidatorMap -} - -type NewSessionValidator interface { - ValidateSession(sourceRouter *Router, clientId *identity.TokenId, service *Service, data []byte) error -} - -type NewTerminatorValidator interface { - ValidateTerminator(terminator *Terminator, data []byte) error -} - -type copyOnWriteNewSessionValidatorMap struct { - value atomic.Value - lock sync.Mutex -} - -func (m *copyOnWriteNewSessionValidatorMap) put(key string, value NewSessionValidator) { - m.lock.Lock() - defer m.lock.Unlock() - - var current = m.value.Load().(map[string]NewSessionValidator) - mapCopy := map[string]NewSessionValidator{} - for k, v := range current { - mapCopy[k] = v - } - mapCopy[key] = value - m.value.Store(mapCopy) -} - -func (m *copyOnWriteNewSessionValidatorMap) get(key string) NewSessionValidator { - var current = m.value.Load().(map[string]NewSessionValidator) - return current[key] -} - -type copyOnWriteNewTerminatorValidatorMap struct { - value atomic.Value - lock sync.Mutex -} - -func (m *copyOnWriteNewTerminatorValidatorMap) put(key string, value NewTerminatorValidator) { - m.lock.Lock() - defer m.lock.Unlock() - - var current = m.value.Load().(map[string]NewTerminatorValidator) - mapCopy := map[string]NewTerminatorValidator{} - for k, v := range current { - mapCopy[k] = v - } - mapCopy[key] = value - m.value.Store(mapCopy) -} - -func (m *copyOnWriteNewTerminatorValidatorMap) get(key string) NewTerminatorValidator { - var current = m.value.Load().(map[string]NewTerminatorValidator) - return current[key] -} diff --git a/pb/ctrl_pb/ctrl.pb.go b/pb/ctrl_pb/ctrl.pb.go index 48f4530eb..f67a3d331 100644 --- a/pb/ctrl_pb/ctrl.pb.go +++ b/pb/ctrl_pb/ctrl.pb.go @@ -153,7 +153,6 @@ type SessionRequest struct { IngressId string `protobuf:"bytes,1,opt,name=ingressId,proto3" json:"ingressId,omitempty"` ServiceId string `protobuf:"bytes,2,opt,name=serviceId,proto3" json:"serviceId,omitempty"` PeerData map[uint32][]byte `protobuf:"bytes,3,rep,name=peerData,proto3" json:"peerData,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - ExtensionData map[string][]byte `protobuf:"bytes,4,rep,name=extensionData,proto3" json:"extensionData,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -205,13 +204,6 @@ func (m *SessionRequest) GetPeerData() map[uint32][]byte { return nil } -func (m *SessionRequest) GetExtensionData() map[string][]byte { - if m != nil { - return m.ExtensionData - } - return nil -} - type CreateTerminatorRequest struct { ServiceId string `protobuf:"bytes,2,opt,name=serviceId,proto3" json:"serviceId,omitempty"` Binding string `protobuf:"bytes,3,opt,name=binding,proto3" json:"binding,omitempty"` @@ -221,7 +213,6 @@ type CreateTerminatorRequest struct { Precedence TerminatorPrecedence `protobuf:"varint,7,opt,name=precedence,proto3,enum=ctrl.pb.TerminatorPrecedence" json:"precedence,omitempty"` Identity string `protobuf:"bytes,8,opt,name=identity,proto3" json:"identity,omitempty"` IdentitySecret []byte `protobuf:"bytes,9,opt,name=identitySecret,proto3" json:"identitySecret,omitempty"` - ExtensionData map[string][]byte `protobuf:"bytes,10,rep,name=extensionData,proto3" json:"extensionData,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -308,13 +299,6 @@ func (m *CreateTerminatorRequest) GetIdentitySecret() []byte { return nil } -func (m *CreateTerminatorRequest) GetExtensionData() map[string][]byte { - if m != nil { - return m.ExtensionData - } - return nil -} - type RemoveTerminatorRequest struct { TerminatorId string `protobuf:"bytes,1,opt,name=terminatorId,proto3" json:"terminatorId,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1010,10 +994,8 @@ func init() { proto.RegisterEnum("ctrl.pb.TerminatorPrecedence", TerminatorPrecedence_name, TerminatorPrecedence_value) proto.RegisterEnum("ctrl.pb.FaultSubject", FaultSubject_name, FaultSubject_value) proto.RegisterType((*SessionRequest)(nil), "ctrl.pb.SessionRequest") - proto.RegisterMapType((map[string][]byte)(nil), "ctrl.pb.SessionRequest.ExtensionDataEntry") proto.RegisterMapType((map[uint32][]byte)(nil), "ctrl.pb.SessionRequest.PeerDataEntry") proto.RegisterType((*CreateTerminatorRequest)(nil), "ctrl.pb.CreateTerminatorRequest") - proto.RegisterMapType((map[string][]byte)(nil), "ctrl.pb.CreateTerminatorRequest.ExtensionDataEntry") proto.RegisterMapType((map[uint32][]byte)(nil), "ctrl.pb.CreateTerminatorRequest.PeerDataEntry") proto.RegisterType((*RemoveTerminatorRequest)(nil), "ctrl.pb.RemoveTerminatorRequest") proto.RegisterType((*Terminator)(nil), "ctrl.pb.Terminator") @@ -1037,70 +1019,67 @@ func init() { } var fileDescriptor_a0572e205f89e843 = []byte{ - // 1027 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xcc, 0x56, 0xcb, 0x6f, 0xe3, 0x44, - 0x18, 0x27, 0xce, 0xc3, 0xc9, 0x97, 0x34, 0x0d, 0xd3, 0xa5, 0x8d, 0x02, 0xac, 0x2a, 0xaf, 0x40, - 0x55, 0x24, 0x02, 0xea, 0x0a, 0x69, 0x59, 0x54, 0xb1, 0x55, 0x9b, 0x8a, 0x22, 0x40, 0x91, 0xd3, - 0x5d, 0x09, 0x6e, 0xae, 0x3d, 0x5b, 0x99, 0x4d, 0xed, 0x30, 0x9e, 0x64, 0xe9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x5a, 0x8f, 0xf1, 0xe0, 0x7c, 0x56, 0x83, 0x9d, 0x23, 0x46, 0x3d, 0x4e, 0xcf, - 0x28, 0xbb, 0x0c, 0x23, 0x8f, 0xc7, 0xcc, 0xe8, 0xf5, 0xbf, 0x74, 0xb3, 0x0f, 0xf6, 0x79, 0x18, - 0x05, 0xa2, 0xf9, 0xa2, 0x99, 0x52, 0x96, 0x92, 0x52, 0xe2, 0x05, 0x81, 0x1c, 0x89, 0x68, 0x0f, - 0x4a, 0x34, 0x49, 0xde, 0x31, 0x26, 0x50, 0xc7, 0xce, 0x8d, 0xb2, 0xce, 0x95, 0x64, 0x51, 0x3a, - 0x0a, 0x02, 0x35, 0x3f, 0x4e, 0x78, 0xbf, 0x81, 0x8d, 0xc2, 0x37, 0x39, 0x00, 0x98, 0x33, 0xea, - 0xd3, 0x80, 0x46, 0x3e, 0xed, 0xdb, 0x42, 0xd2, 0xdd, 0x7f, 0x31, 0x8b, 0xb0, 0xf2, 0x3d, 0xc9, - 0x94, 0x5c, 0xc3, 0x80, 0x0c, 0xa0, 0x19, 0x8a, 0x17, 0x0f, 0xf9, 0x55, 0xbf, 0x89, 0x99, 0x67, - 0x34, 0x79, 0x19, 0xba, 0xe9, 0x7b, 0x4a, 0x7d, 0x46, 0x79, 0xbf, 0x85, 0xbd, 0x2c, 0x70, 0xc9, - 0x07, 0x45, 0x84, 0x00, 0xd6, 0x79, 0xf3, 0xb1, 0x75, 0x3e, 0xf5, 0x50, 0x39, 0x80, 0x1d, 0x97, - 0x5e, 0xc6, 0xcb, 0x35, 0x48, 0x71, 0xa0, 0xc3, 0x33, 0x66, 0xb6, 0x98, 0x39, 0x9e, 0x33, 0x01, - 0x58, 0x19, 0x92, 0x2e, 0x58, 0x61, 0xaa, 0x27, 0x5e, 0x26, 0x9a, 0xac, 0x52, 0x34, 0x55, 0x73, - 0x68, 0x72, 0xa6, 0x30, 0xb8, 0xe7, 0xcd, 0xc2, 0x20, 0xd7, 0xce, 0x24, 0x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0x85, 0x00, - 0x34, 0x54, 0x2a, 0x3d, 0x6b, 0x78, 0x07, 0x3a, 0xe6, 0x35, 0x14, 0xdd, 0x16, 0x18, 0xc2, 0x55, - 0x3f, 0xd1, 0xb6, 0x9b, 0xd0, 0x1e, 0x1b, 0x8c, 0x8a, 0x98, 0x68, 0x4b, 0x4e, 0x54, 0x91, 0xd6, - 0x79, 0x03, 0xff, 0x8e, 0x6f, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x19, 0x28, 0x82, 0x2b, - 0x0b, 0x00, 0x00, + // 984 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0xe3, 0x44, + 0x14, 0xc6, 0xce, 0x8f, 0x9d, 0x93, 0x34, 0x0d, 0xd3, 0xa5, 0x8d, 0x02, 0xac, 0x2a, 0xaf, 0x40, + 0x55, 0x25, 0x02, 0x2a, 0x42, 0x5a, 0x16, 0x55, 0x50, 0xf5, 0x47, 0x14, 0x01, 0xaa, 0x9c, 0xee, + 0x5e, 0x70, 0xe7, 0xda, 0x67, 0x2b, 0xb3, 0xa9, 0x1d, 0xc6, 0x93, 0xac, 0xf2, 0x0c, 0xbc, 0x05, + 0x8f, 0xc0, 0x15, 0x17, 0x3c, 0x02, 0x8f, 0xc0, 0x03, 0xf0, 0x0f, 0xe2, 0x4f, 0x70, 0xc7, 0xcc, + 0xf1, 0xd8, 0x19, 0x87, 0x04, 0x2d, 0x42, 0xdc, 0xcd, 0xf9, 0xce, 0x39, 0x33, 0xe7, 0x9b, 0xef, + 0x9c, 0xb1, 0x01, 0x42, 0xc1, 0xc7, 0xc3, 0x09, 0x4f, 0x45, 0xca, 0x9c, 0x7c, 0x7d, 0xe5, 0x7d, + 0x61, 0x41, 0x77, 0x84, 0x59, 0x16, 0xa7, 0x89, 0x8f, 0x1f, 0x4d, 0x31, 0x13, 0xec, 0x39,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4a, 0x28, 0xe2, 0x57, 0x62, 0x5d, 0xed, 0x11, + 0x72, 0xfc, 0xe6, 0x48, 0xb1, 0xb7, 0x96, 0x34, 0x22, 0xcf, 0xef, 0x8e, 0x14, 0xfb, 0x69, 0x7d, + 0x51, 0x67, 0x41, 0x3c, 0xc6, 0x88, 0xf0, 0x3f, 0x1c, 0x76, 0x07, 0x6e, 0xaf, 0xff, 0x4c, 0x50, + 0xd0, 0x9f, 0x54, 0xd1, 0x9a, 0x57, 0x9f, 0x22, 0x3e, 0x79, 0x7f, 0xff, 0x10, 0x6e, 0xad, 0x7a, + 0x71, 0x59, 0x1b, 0x9c, 0x13, 0x7c, 0xa8, 0xae, 0x5a, 0xaa, 0xd8, 0x01, 0x57, 0xa5, 0xc5, 0x1c, + 0xa3, 0x9e, 0xc5, 0x00, 0x9a, 0x79, 0x29, 0x3d, 0x7b, 0xff, 0x2d, 0xe8, 0x98, 0xaf, 0xa1, 0xbc, + 0x6d, 0xd9, 0x43, 0x34, 0xea, 0x67, 0x3a, 0x77, 0x13, 0xda, 0xa7, 0x06, 0x60, 0x49, 0x45, 0x5b, + 0x4a, 0xd1, 0xdc, 0xb4, 0xaf, 0x9a, 0xf4, 0xb3, 0xf7, 0xea, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x87, 0x0e, 0xeb, 0xdc, 0xfa, 0x09, 0x00, 0x00, } diff --git a/pb/ctrl_pb/ctrl.proto b/pb/ctrl_pb/ctrl.proto index 3de75cc38..8c0b3115c 100644 --- a/pb/ctrl_pb/ctrl.proto +++ b/pb/ctrl_pb/ctrl.proto @@ -3,128 +3,126 @@ syntax = "proto3"; package ctrl.pb; enum ContentType { - Zero = 0; + Zero = 0; - SessionRequestType = 1000; - SessionSuccessType = 1001; - DialType = 1002; - LinkType = 1003; - FaultType = 1004; - RouteType = 1005; - UnrouteType = 1006; - MetricsType = 1007; - TogglePipeTracesRequestType = 1008; - TraceEventType = 1010; - CreateTerminatorRequestType = 1011; - RemoveTerminatorRequestType = 1012; - InspectRequestType = 1013; - InspectResponseType = 1014; - SessionFailedType = 1016; - ValidateTerminatorsRequestType = 1017; - UpdateTerminatorRequestType = 10018; + SessionRequestType = 1000; + SessionSuccessType = 1001; + DialType = 1002; + LinkType = 1003; + FaultType = 1004; + RouteType = 1005; + UnrouteType = 1006; + MetricsType = 1007; + TogglePipeTracesRequestType = 1008; + TraceEventType = 1010; + CreateTerminatorRequestType = 1011; + RemoveTerminatorRequestType = 1012; + InspectRequestType = 1013; + InspectResponseType = 1014; + SessionFailedType = 1016; + ValidateTerminatorsRequestType = 1017; + UpdateTerminatorRequestType = 10018; } message SessionRequest { - string ingressId = 1; - string serviceId = 2; - map peerData = 3; - map extensionData = 4; + string ingressId = 1; + string serviceId = 2; + map peerData = 3; } enum TerminatorPrecedence { - Default = 0; - Required = 1; - Failed = 2; + Default = 0; + Required = 1; + Failed = 2; } message CreateTerminatorRequest { - string serviceId = 2; - string binding = 3; - string address = 4; - map peerData = 5; - uint32 cost = 6; - TerminatorPrecedence precedence = 7; - string identity = 8; - bytes identitySecret = 9; - map extensionData = 10; + string serviceId = 2; + string binding = 3; + string address = 4; + map peerData = 5; + uint32 cost = 6; + TerminatorPrecedence precedence = 7; + string identity = 8; + bytes identitySecret = 9; } message RemoveTerminatorRequest { - string terminatorId = 1; + string terminatorId = 1; } message Terminator { - string id = 1; - string binding = 2; - string address = 3; + string id = 1; + string binding = 2; + string address = 3; } message ValidateTerminatorsRequest { - repeated Terminator terminators = 1; + repeated Terminator terminators = 1; } message UpdateTerminatorRequest { - string terminatorId = 1; - bool updatePrecedence = 2; - bool updateCost = 3; - TerminatorPrecedence precedence = 4; - uint32 cost = 5; + string terminatorId = 1; + bool updatePrecedence = 2; + bool updateCost = 3; + TerminatorPrecedence precedence = 4; + uint32 cost = 5; } message Dial { - string id = 1; - string address = 2; + string id = 1; + string address = 2; } message Link { - string id = 1; + string id = 1; } enum FaultSubject { - IngressFault = 0; - EgressFault = 1; - LinkFault = 2; + IngressFault = 0; + EgressFault = 1; + LinkFault = 2; } message Fault { - FaultSubject subject = 1; - string id = 2; + FaultSubject subject = 1; + string id = 2; } message Route { - string sessionId = 1; + string sessionId = 1; - message Egress { - string binding = 1; - string address = 2; - string destination = 3; - map peerData = 4; - } - Egress egress = 2; + message Egress { + string binding = 1; + string address = 2; + string destination = 3; + map peerData = 4; + } + Egress egress = 2; - message Forward { - string srcAddress = 1; - string dstAddress = 2; - } - repeated Forward forwards = 3; + message Forward { + string srcAddress = 1; + string dstAddress = 2; + } + repeated Forward forwards = 3; } message Unroute { - string sessionId = 1; - bool now = 2; + string sessionId = 1; + bool now = 2; } message InspectRequest { - repeated string requestedValues = 1; + repeated string requestedValues = 1; } message InspectResponse { - bool success = 1; - repeated string errors = 2; - repeated InspectValue values = 3; + bool success = 1; + repeated string errors = 2; + repeated InspectValue values = 3; - message InspectValue { - string name = 1; - string value = 2; - } + message InspectValue { + string name = 1; + string value = 2; + } } \ No newline at end of file diff --git a/router/xgress/link_send_buffer.go b/router/xgress/link_send_buffer.go index 07351fbeb..a69df1234 100644 --- a/router/xgress/link_send_buffer.go +++ b/router/xgress/link_send_buffer.go @@ -315,7 +315,7 @@ func (buffer *LinkSendBuffer) retransmit() { } if retransmitted > 0 { - log.Infof("retransmitted [%d] payloads, [%d] buffered, linkSendBufferSize: %d", retransmitted, len(buffer.buffer), buffer.linkSendBufferSize) + log.Debugf("retransmitted [%d] payloads, [%d] buffered, linkSendBufferSize: %d", retransmitted, len(buffer.buffer), buffer.linkSendBufferSize) } buffer.lastRetransmitTime = now } diff --git a/router/xgress/xgress.go b/router/xgress/xgress.go index f4adaf3e7..8d65083d0 100644 --- a/router/xgress/xgress.go +++ b/router/xgress/xgress.go @@ -421,6 +421,11 @@ func (self *Xgress) tx() { func (self *Xgress) flushSendThenClose() { self.CloseTimeout(self.Options.MaxCloseWait) self.ForwardEndOfSession(func(payload *Payload) bool { + if self.payloadBuffer.closed.Get() { + // Avoid spurious 'failed to forward payload' error if the buffer is already closed + return false + } + pfxlog.ContextLogger(self.Label()).Debug("sending end of session payload") return self.forwardPayload(payload) }) @@ -495,7 +500,7 @@ func (self *Xgress) forwardPayload(payload *Payload) bool { sendCallback, err := self.payloadBuffer.BufferPayload(payload) if err != nil { - pfxlog.ContextLogger(self.Label()).WithError(err).Error("failure forwarding payload") + pfxlog.ContextLogger(self.Label()).WithError(err).Error("failure to buffer payload") return false }