refactor(sessionwire): delete dead client dialer and superseded convert wrappers
clientDialer/NewClientDialer/ensurePreambleWith were an old pre-broker client-side dialer with zero production callers now that the broker owns every connection; their only test is deleted with them. The ten cellStyle/previewCell/remoteTarget/tabSelector *ToWire/*FromWire wrappers in proto_convert_shared.go duplicated internal/adapters/protoconv with no remaining caller; the two range-boundary cases that exercised them are already covered against the real production path in protoconv_test.go.
- commit
- a54aa396a379acd3e57f366d7e3900f6e828357e
- author
- brice · · 2026-09-23 01:54 UTC
- parent
- 97d6a05
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +1 -156
M internal/adapters/sessionwire/client.go +1 -39
| @@ -41,7 +41,7 @@ var _ ports.ClientConnection = (*clientConnection)(nil) | |||
| 41 | 41 | ||
| 42 | 42 | // NewClientConnection wraps one raw client connection incarnation. The | |
| 43 | 43 | // preamble runs lazily on first use, bounded by the handshake deadline | |
| 44 | - | // started here; prefer NewClientDialer, which runs it inside Dial. | |
| 44 | + | // started here. | |
| 45 | 45 | func NewClientConnection(raw wire.Transport) ports.ClientConnection { | |
| 46 | 46 | if raw == nil { | |
| 47 | 47 | return nil | |
| @@ -186,44 +186,6 @@ func (c *clientConnection) LinkState() ports.LinkState { return rawLinkS | |||
| 186 | 186 | func (c *clientConnection) LinkEvents() <-chan ports.LinkEvent { return rawLinkEvents(c.raw) } | |
| 187 | 187 | func (c *clientConnection) Close() error { return c.raw.Close() } | |
| 188 | 188 | ||
| 189 | - | type clientDialer struct{ raw wire.Dialer } | |
| 190 | - | ||
| 191 | - | var _ ports.ClientDialer = (*clientDialer)(nil) | |
| 192 | - | ||
| 193 | - | // NewClientDialer wraps every dialed raw connection in a stable typed adapter. | |
| 194 | - | func NewClientDialer(raw wire.Dialer) ports.ClientDialer { | |
| 195 | - | if raw == nil { | |
| 196 | - | return nil | |
| 197 | - | } | |
| 198 | - | return &clientDialer{raw: raw} | |
| 199 | - | } | |
| 200 | - | ||
| 201 | - | func (d *clientDialer) Dial(ctx context.Context) (ports.ClientConnection, error) { | |
| 202 | - | raw, err := d.raw.Dial(ctx) | |
| 203 | - | if err != nil { | |
| 204 | - | return nil, err | |
| 205 | - | } | |
| 206 | - | connection := &clientConnection{raw: raw, ceilings: defaultProtoCeilings(), deadline: time.Now().Add(protocol.HandshakeTimeout), preambleDone: make(chan struct{})} | |
| 207 | - | if err := connection.ensurePreambleWith(ctx); err != nil { | |
| 208 | - | _ = raw.Close() | |
| 209 | - | return nil, err | |
| 210 | - | } | |
| 211 | - | return connection, nil | |
| 212 | - | } | |
| 213 | - | ||
| 214 | - | func (c *clientConnection) ensurePreambleWith(ctx context.Context) error { | |
| 215 | - | c.preambleOnce.Do(func() { | |
| 216 | - | ctx, cancel := context.WithDeadline(ctx, c.deadline) | |
| 217 | - | defer cancel() | |
| 218 | - | next, err := runProtoClientPreamble(ctx, c.raw, c.limits()) | |
| 219 | - | c.publishLimits(next) | |
| 220 | - | c.preambleErr = err | |
| 221 | - | c.finishPreamble() | |
| 222 | - | }) | |
| 223 | - | c.runHandshakeHooks() | |
| 224 | - | return c.preambleErr | |
| 225 | - | } | |
| 226 | - | ||
| 227 | 189 | // DecodeServerEnvelope unwraps one scanned server envelope payload into | |
| 228 | 190 | // its semantic message for hidden one-shot carriages. | |
| 229 | 191 | func DecodeServerEnvelope(payload []byte) (protocol.ServerMessage, error) { | |
| @@ -41,7 +41,7 @@ var _ ports.ClientConnection = (*clientConnection)(nil) | |||||
| 41 | 41 | ||||
| 42 | // NewClientConnection wraps one raw client connection incarnation. The | 42 | // NewClientConnection wraps one raw client connection incarnation. The | ||
| 43 | // preamble runs lazily on first use, bounded by the handshake deadline | 43 | // preamble runs lazily on first use, bounded by the handshake deadline | ||
| 44 | - | // started here; prefer NewClientDialer, which runs it inside Dial. | 44 | + | // started here. |
| 45 | func NewClientConnection(raw wire.Transport) ports.ClientConnection { | 45 | func NewClientConnection(raw wire.Transport) ports.ClientConnection { | ||
| 46 | if raw == nil { | 46 | if raw == nil { | ||
| 47 | return nil | 47 | return nil | ||
| @@ -186,44 +186,6 @@ func (c *clientConnection) LinkState() ports.LinkState { return rawLinkS | |||||
| 186 | func (c *clientConnection) LinkEvents() <-chan ports.LinkEvent { return rawLinkEvents(c.raw) } | 186 | func (c *clientConnection) LinkEvents() <-chan ports.LinkEvent { return rawLinkEvents(c.raw) } | ||
| 187 | func (c *clientConnection) Close() error { return c.raw.Close() } | 187 | func (c *clientConnection) Close() error { return c.raw.Close() } | ||
| 188 | 188 | ||||
| 189 | - | type clientDialer struct{ raw wire.Dialer } | |||
| 190 | - | ||||
| 191 | - | var _ ports.ClientDialer = (*clientDialer)(nil) | |||
| 192 | - | ||||
| 193 | - | // NewClientDialer wraps every dialed raw connection in a stable typed adapter. | |||
| 194 | - | func NewClientDialer(raw wire.Dialer) ports.ClientDialer { | |||
| 195 | - | if raw == nil { | |||
| 196 | - | return nil | |||
| 197 | - | } | |||
| 198 | - | return &clientDialer{raw: raw} | |||
| 199 | - | } | |||
| 200 | - | ||||
| 201 | - | func (d *clientDialer) Dial(ctx context.Context) (ports.ClientConnection, error) { | |||
| 202 | - | raw, err := d.raw.Dial(ctx) | |||
| 203 | - | if err != nil { | |||
| 204 | - | return nil, err | |||
| 205 | - | } | |||
| 206 | - | connection := &clientConnection{raw: raw, ceilings: defaultProtoCeilings(), deadline: time.Now().Add(protocol.HandshakeTimeout), preambleDone: make(chan struct{})} | |||
| 207 | - | if err := connection.ensurePreambleWith(ctx); err != nil { | |||
| 208 | - | _ = raw.Close() | |||
| 209 | - | return nil, err | |||
| 210 | - | } | |||
| 211 | - | return connection, nil | |||
| 212 | - | } | |||
| 213 | - | ||||
| 214 | - | func (c *clientConnection) ensurePreambleWith(ctx context.Context) error { | |||
| 215 | - | c.preambleOnce.Do(func() { | |||
| 216 | - | ctx, cancel := context.WithDeadline(ctx, c.deadline) | |||
| 217 | - | defer cancel() | |||
| 218 | - | next, err := runProtoClientPreamble(ctx, c.raw, c.limits()) | |||
| 219 | - | c.publishLimits(next) | |||
| 220 | - | c.preambleErr = err | |||
| 221 | - | c.finishPreamble() | |||
| 222 | - | }) | |||
| 223 | - | c.runHandshakeHooks() | |||
| 224 | - | return c.preambleErr | |||
| 225 | - | } | |||
| 226 | - | ||||
| 227 | // DecodeServerEnvelope unwraps one scanned server envelope payload into | 189 | // DecodeServerEnvelope unwraps one scanned server envelope payload into | ||
| 228 | // its semantic message for hidden one-shot carriages. | 190 | // its semantic message for hidden one-shot carriages. | ||
| 229 | func DecodeServerEnvelope(payload []byte) (protocol.ServerMessage, error) { | 191 | func DecodeServerEnvelope(payload []byte) (protocol.ServerMessage, error) { | ||
M internal/adapters/sessionwire/client_test.go +0 -27
| @@ -1,8 +1,6 @@ | |||
| 1 | 1 | package sessionwire | |
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | - | "context" | |
| 5 | - | "errors" | |
| 6 | 4 | "testing" | |
| 7 | 5 | "time" | |
| 8 | 6 | ||
| @@ -140,28 +138,3 @@ func TestClientConnectionClassifiesFailuresAndPreservesCapabilities(t *testing.T | |||
| 140 | 138 | require.Equal(t, (<-chan ports.LinkEvent)(events), connection.LinkEvents()) | |
| 141 | 139 | }) | |
| 142 | 140 | } | |
| 143 | - | ||
| 144 | - | func TestClientDialerWrapsEachConnectionAndPreservesErrors(t *testing.T) { | |
| 145 | - | dialErr := errors.New("dial failed") | |
| 146 | - | dialer := NewClientDialer(&scriptedDialer{err: dialErr}) | |
| 147 | - | _, err := dialer.Dial(context.Background()) | |
| 148 | - | require.ErrorIs(t, err, dialErr) | |
| 149 | - | ||
| 150 | - | raw := &scriptedTransport{recv: []wire.Envelope{mustPreambleResponse(t)}} | |
| 151 | - | dialer = NewClientDialer(&scriptedDialer{transport: raw}) | |
| 152 | - | connection, err := dialer.Dial(context.Background()) | |
| 153 | - | require.NoError(t, err) | |
| 154 | - | require.NoError(t, connection.SendClient(protocol.Ping{})) | |
| 155 | - | got, err := DecodeClientEnvelope(mustSingleAppPayload(t, raw)) | |
| 156 | - | require.NoError(t, err) | |
| 157 | - | require.Equal(t, protocol.Ping{}, got) | |
| 158 | - | } | |
| 159 | - | ||
| 160 | - | type scriptedDialer struct { | |
| 161 | - | transport wire.Transport | |
| 162 | - | err error | |
| 163 | - | } | |
| 164 | - | ||
| 165 | - | func (d *scriptedDialer) Dial(context.Context) (wire.Transport, error) { | |
| 166 | - | return d.transport, d.err | |
| 167 | - | } | |
| @@ -1,8 +1,6 @@ | |||||
| 1 | package sessionwire | 1 | package sessionwire | ||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | - | "context" | |||
| 5 | - | "errors" | |||
| 6 | "testing" | 4 | "testing" | ||
| 7 | "time" | 5 | "time" | ||
| 8 | 6 | ||||
| @@ -140,28 +138,3 @@ func TestClientConnectionClassifiesFailuresAndPreservesCapabilities(t *testing.T | |||||
| 140 | require.Equal(t, (<-chan ports.LinkEvent)(events), connection.LinkEvents()) | 138 | require.Equal(t, (<-chan ports.LinkEvent)(events), connection.LinkEvents()) | ||
| 141 | }) | 139 | }) | ||
| 142 | } | 140 | } | ||
| 143 | - | ||||
| 144 | - | func TestClientDialerWrapsEachConnectionAndPreservesErrors(t *testing.T) { | |||
| 145 | - | dialErr := errors.New("dial failed") | |||
| 146 | - | dialer := NewClientDialer(&scriptedDialer{err: dialErr}) | |||
| 147 | - | _, err := dialer.Dial(context.Background()) | |||
| 148 | - | require.ErrorIs(t, err, dialErr) | |||
| 149 | - | ||||
| 150 | - | raw := &scriptedTransport{recv: []wire.Envelope{mustPreambleResponse(t)}} | |||
| 151 | - | dialer = NewClientDialer(&scriptedDialer{transport: raw}) | |||
| 152 | - | connection, err := dialer.Dial(context.Background()) | |||
| 153 | - | require.NoError(t, err) | |||
| 154 | - | require.NoError(t, connection.SendClient(protocol.Ping{})) | |||
| 155 | - | got, err := DecodeClientEnvelope(mustSingleAppPayload(t, raw)) | |||
| 156 | - | require.NoError(t, err) | |||
| 157 | - | require.Equal(t, protocol.Ping{}, got) | |||
| 158 | - | } | |||
| 159 | - | ||||
| 160 | - | type scriptedDialer struct { | |||
| 161 | - | transport wire.Transport | |||
| 162 | - | err error | |||
| 163 | - | } | |||
| 164 | - | ||||
| 165 | - | func (d *scriptedDialer) Dial(context.Context) (wire.Transport, error) { | |||
| 166 | - | return d.transport, d.err | |||
| 167 | - | } | |||
M internal/adapters/sessionwire/proto_convert_range_test.go +0 -16
| @@ -200,22 +200,6 @@ func TestNarrowingConversionsRejectOverflow(t *testing.T) { | |||
| 200 | 200 | }, | |
| 201 | 201 | wantErr: errProtoConvertRange, | |
| 202 | 202 | }, | |
| 203 | - | { | |
| 204 | - | name: "preview cell rune", | |
| 205 | - | run: func(t *testing.T) error { | |
| 206 | - | _, err := previewCellFromWire(&wire.PreviewCell{RuneValue: 0x110000}) | |
| 207 | - | return err | |
| 208 | - | }, | |
| 209 | - | wantErr: errProtoConvertRange, | |
| 210 | - | }, | |
| 211 | - | { | |
| 212 | - | name: "underline style narrowing", | |
| 213 | - | run: func(t *testing.T) error { | |
| 214 | - | _, err := cellStyleFromWire(&wire.CellStyle{UnderlineStyle: 256}) | |
| 215 | - | return err | |
| 216 | - | }, | |
| 217 | - | wantErr: errProtoConvertRange, | |
| 218 | - | }, | |
| 219 | 203 | { | |
| 220 | 204 | name: "picker line kind", | |
| 221 | 205 | run: func(t *testing.T) error { _, err := pickerLineFromWire(&wire.PickerLine{Kind: 256}); return err }, | |
| @@ -200,22 +200,6 @@ func TestNarrowingConversionsRejectOverflow(t *testing.T) { | |||||
| 200 | }, | 200 | }, | ||
| 201 | wantErr: errProtoConvertRange, | 201 | wantErr: errProtoConvertRange, | ||
| 202 | }, | 202 | }, | ||
| 203 | - | { | |||
| 204 | - | name: "preview cell rune", | |||
| 205 | - | run: func(t *testing.T) error { | |||
| 206 | - | _, err := previewCellFromWire(&wire.PreviewCell{RuneValue: 0x110000}) | |||
| 207 | - | return err | |||
| 208 | - | }, | |||
| 209 | - | wantErr: errProtoConvertRange, | |||
| 210 | - | }, | |||
| 211 | - | { | |||
| 212 | - | name: "underline style narrowing", | |||
| 213 | - | run: func(t *testing.T) error { | |||
| 214 | - | _, err := cellStyleFromWire(&wire.CellStyle{UnderlineStyle: 256}) | |||
| 215 | - | return err | |||
| 216 | - | }, | |||
| 217 | - | wantErr: errProtoConvertRange, | |||
| 218 | - | }, | |||
| 219 | { | 203 | { | ||
| 220 | name: "picker line kind", | 204 | name: "picker line kind", | ||
| 221 | run: func(t *testing.T) error { _, err := pickerLineFromWire(&wire.PickerLine{Kind: 256}); return err }, | 205 | run: func(t *testing.T) error { _, err := pickerLineFromWire(&wire.PickerLine{Kind: 256}); return err }, | ||
M internal/adapters/sessionwire/proto_convert_shared.go +0 -74
| @@ -63,36 +63,6 @@ func lifecycleFromWire(message *wire.LifecycleID) (domain.SessionLifecycleID, er | |||
| 63 | 63 | return id, nil | |
| 64 | 64 | } | |
| 65 | 65 | ||
| 66 | - | func tabSelectorToWire(selector domain.TabSelector) *wire.TabSelector { | |
| 67 | - | return protoconv.TabSelectorToWire(selector) | |
| 68 | - | } | |
| 69 | - | ||
| 70 | - | func tabSelectorFromWire(message *wire.TabSelector) (domain.TabSelector, error) { | |
| 71 | - | selector, err := protoconv.TabSelectorFromWire(message) | |
| 72 | - | if err != nil { | |
| 73 | - | return domain.TabSelector{}, errProtoConvertRange | |
| 74 | - | } | |
| 75 | - | return selector, nil | |
| 76 | - | } | |
| 77 | - | ||
| 78 | - | func remoteTargetToWire(target *domain.RemoteSessionTarget) (*wire.RemoteTarget, error) { | |
| 79 | - | if target == nil { | |
| 80 | - | return nil, nil | |
| 81 | - | } | |
| 82 | - | return protoconv.RemoteTargetToWire(*target), nil | |
| 83 | - | } | |
| 84 | - | ||
| 85 | - | func remoteTargetFromWire(message *wire.RemoteTarget) (*domain.RemoteSessionTarget, error) { | |
| 86 | - | if message == nil { | |
| 87 | - | return nil, nil | |
| 88 | - | } | |
| 89 | - | target, err := protoconv.RemoteTargetFromWire(message) | |
| 90 | - | if err != nil { | |
| 91 | - | return nil, errProtoConvertRange | |
| 92 | - | } | |
| 93 | - | return &target, nil | |
| 94 | - | } | |
| 95 | - | ||
| 96 | 66 | func exactTargetToWire(target *protocol.ExactSessionTarget) *wire.ExactTarget { | |
| 97 | 67 | if target == nil { | |
| 98 | 68 | return nil | |
| @@ -123,50 +93,6 @@ func rgbFromWire(message *wire.RGB) (renderer.RGB, error) { | |||
| 123 | 93 | return color, nil | |
| 124 | 94 | } | |
| 125 | 95 | ||
| 126 | - | func cellStyleToWire(style renderer.Style) *wire.CellStyle { | |
| 127 | - | return protoconv.CellStyleToWire(style) | |
| 128 | - | } | |
| 129 | - | ||
| 130 | - | func cellStyleFromWire(message *wire.CellStyle) (renderer.Style, error) { | |
| 131 | - | style, err := protoconv.CellStyleFromWire(message) | |
| 132 | - | if err != nil { | |
| 133 | - | return renderer.Style{}, errProtoConvertRange | |
| 134 | - | } | |
| 135 | - | return style, nil | |
| 136 | - | } | |
| 137 | - | ||
| 138 | - | func previewCellToWire(cell renderer.Cell) (*wire.PreviewCell, error) { | |
| 139 | - | out, err := protoconv.PreviewCellToWire(cell) | |
| 140 | - | if err != nil { | |
| 141 | - | return nil, errProtoConvertRange | |
| 142 | - | } | |
| 143 | - | return out, nil | |
| 144 | - | } | |
| 145 | - | ||
| 146 | - | func previewCellFromWire(message *wire.PreviewCell) (renderer.Cell, error) { | |
| 147 | - | cell, err := protoconv.PreviewCellFromWire(message) | |
| 148 | - | if err != nil { | |
| 149 | - | return renderer.Cell{}, errProtoConvertRange | |
| 150 | - | } | |
| 151 | - | return cell, nil | |
| 152 | - | } | |
| 153 | - | ||
| 154 | - | func previewCellsToWire(cells []renderer.Cell) ([]*wire.PreviewCell, error) { | |
| 155 | - | out, err := protoconv.PreviewCellsToWire(cells) | |
| 156 | - | if err != nil { | |
| 157 | - | return nil, errProtoConvertRange | |
| 158 | - | } | |
| 159 | - | return out, nil | |
| 160 | - | } | |
| 161 | - | ||
| 162 | - | func previewCellsFromWire(cells []*wire.PreviewCell) ([]renderer.Cell, error) { | |
| 163 | - | out, err := protoconv.PreviewCellsFromWire(cells) | |
| 164 | - | if err != nil { | |
| 165 | - | return nil, errProtoConvertRange | |
| 166 | - | } | |
| 167 | - | return out, nil | |
| 168 | - | } | |
| 169 | - | ||
| 170 | 96 | func registrationToWire(registration domain.RemoteRegistration) *wire.RemoteRegistration { | |
| 171 | 97 | incarnation := append([]byte(nil), registration.Incarnation[:]...) | |
| 172 | 98 | return &wire.RemoteRegistration{Endpoint: registration.Endpoint, Incarnation: incarnation, Generation: uint64(registration.Generation)} | |
| @@ -63,36 +63,6 @@ func lifecycleFromWire(message *wire.LifecycleID) (domain.SessionLifecycleID, er | |||||
| 63 | return id, nil | 63 | return id, nil | ||
| 64 | } | 64 | } | ||
| 65 | 65 | ||||
| 66 | - | func tabSelectorToWire(selector domain.TabSelector) *wire.TabSelector { | |||
| 67 | - | return protoconv.TabSelectorToWire(selector) | |||
| 68 | - | } | |||
| 69 | - | ||||
| 70 | - | func tabSelectorFromWire(message *wire.TabSelector) (domain.TabSelector, error) { | |||
| 71 | - | selector, err := protoconv.TabSelectorFromWire(message) | |||
| 72 | - | if err != nil { | |||
| 73 | - | return domain.TabSelector{}, errProtoConvertRange | |||
| 74 | - | } | |||
| 75 | - | return selector, nil | |||
| 76 | - | } | |||
| 77 | - | ||||
| 78 | - | func remoteTargetToWire(target *domain.RemoteSessionTarget) (*wire.RemoteTarget, error) { | |||
| 79 | - | if target == nil { | |||
| 80 | - | return nil, nil | |||
| 81 | - | } | |||
| 82 | - | return protoconv.RemoteTargetToWire(*target), nil | |||
| 83 | - | } | |||
| 84 | - | ||||
| 85 | - | func remoteTargetFromWire(message *wire.RemoteTarget) (*domain.RemoteSessionTarget, error) { | |||
| 86 | - | if message == nil { | |||
| 87 | - | return nil, nil | |||
| 88 | - | } | |||
| 89 | - | target, err := protoconv.RemoteTargetFromWire(message) | |||
| 90 | - | if err != nil { | |||
| 91 | - | return nil, errProtoConvertRange | |||
| 92 | - | } | |||
| 93 | - | return &target, nil | |||
| 94 | - | } | |||
| 95 | - | ||||
| 96 | func exactTargetToWire(target *protocol.ExactSessionTarget) *wire.ExactTarget { | 66 | func exactTargetToWire(target *protocol.ExactSessionTarget) *wire.ExactTarget { | ||
| 97 | if target == nil { | 67 | if target == nil { | ||
| 98 | return nil | 68 | return nil | ||
| @@ -123,50 +93,6 @@ func rgbFromWire(message *wire.RGB) (renderer.RGB, error) { | |||||
| 123 | return color, nil | 93 | return color, nil | ||
| 124 | } | 94 | } | ||
| 125 | 95 | ||||
| 126 | - | func cellStyleToWire(style renderer.Style) *wire.CellStyle { | |||
| 127 | - | return protoconv.CellStyleToWire(style) | |||
| 128 | - | } | |||
| 129 | - | ||||
| 130 | - | func cellStyleFromWire(message *wire.CellStyle) (renderer.Style, error) { | |||
| 131 | - | style, err := protoconv.CellStyleFromWire(message) | |||
| 132 | - | if err != nil { | |||
| 133 | - | return renderer.Style{}, errProtoConvertRange | |||
| 134 | - | } | |||
| 135 | - | return style, nil | |||
| 136 | - | } | |||
| 137 | - | ||||
| 138 | - | func previewCellToWire(cell renderer.Cell) (*wire.PreviewCell, error) { | |||
| 139 | - | out, err := protoconv.PreviewCellToWire(cell) | |||
| 140 | - | if err != nil { | |||
| 141 | - | return nil, errProtoConvertRange | |||
| 142 | - | } | |||
| 143 | - | return out, nil | |||
| 144 | - | } | |||
| 145 | - | ||||
| 146 | - | func previewCellFromWire(message *wire.PreviewCell) (renderer.Cell, error) { | |||
| 147 | - | cell, err := protoconv.PreviewCellFromWire(message) | |||
| 148 | - | if err != nil { | |||
| 149 | - | return renderer.Cell{}, errProtoConvertRange | |||
| 150 | - | } | |||
| 151 | - | return cell, nil | |||
| 152 | - | } | |||
| 153 | - | ||||
| 154 | - | func previewCellsToWire(cells []renderer.Cell) ([]*wire.PreviewCell, error) { | |||
| 155 | - | out, err := protoconv.PreviewCellsToWire(cells) | |||
| 156 | - | if err != nil { | |||
| 157 | - | return nil, errProtoConvertRange | |||
| 158 | - | } | |||
| 159 | - | return out, nil | |||
| 160 | - | } | |||
| 161 | - | ||||
| 162 | - | func previewCellsFromWire(cells []*wire.PreviewCell) ([]renderer.Cell, error) { | |||
| 163 | - | out, err := protoconv.PreviewCellsFromWire(cells) | |||
| 164 | - | if err != nil { | |||
| 165 | - | return nil, errProtoConvertRange | |||
| 166 | - | } | |||
| 167 | - | return out, nil | |||
| 168 | - | } | |||
| 169 | - | ||||
| 170 | func registrationToWire(registration domain.RemoteRegistration) *wire.RemoteRegistration { | 96 | func registrationToWire(registration domain.RemoteRegistration) *wire.RemoteRegistration { | ||
| 171 | incarnation := append([]byte(nil), registration.Incarnation[:]...) | 97 | incarnation := append([]byte(nil), registration.Incarnation[:]...) | ||
| 172 | return &wire.RemoteRegistration{Endpoint: registration.Endpoint, Incarnation: incarnation, Generation: uint64(registration.Generation)} | 98 | return &wire.RemoteRegistration{Endpoint: registration.Endpoint, Incarnation: incarnation, Generation: uint64(registration.Generation)} | ||