forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 4
/
messages.go
737 lines (647 loc) · 19.4 KB
/
messages.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package message
import (
"crypto/x509"
"errors"
"fmt"
"net"
"strings"
"sync"
"time"
"github.com/prometheus/client_golang/prometheus"
"google.golang.org/protobuf/proto"
"github.com/MetalBlockchain/metalgo/ids"
"github.com/MetalBlockchain/metalgo/utils/compression"
"github.com/MetalBlockchain/metalgo/utils/ips"
"github.com/MetalBlockchain/metalgo/utils/metric"
"github.com/MetalBlockchain/metalgo/utils/timer/mockable"
"github.com/MetalBlockchain/metalgo/utils/wrappers"
p2ppb "github.com/MetalBlockchain/metalgo/proto/pb/p2p"
)
var (
_ InboundMessage = &inboundMessageWithPacker{}
_ InboundMessage = &inboundMessageWithProto{}
_ OutboundMessage = &outboundMessageWithPacker{}
_ OutboundMessage = &outboundMessageWithProto{}
errUnknownMessageTypeForOp = errors.New("unknown message type for Op")
errInvalidIPAddrLen = errors.New("invalid IP address field length (expected 16-byte)")
errInvalidCert = errors.New("invalid TLS certificate field")
)
// InboundMessage represents a set of fields for an inbound message that can be serialized into a byte stream
type InboundMessage interface {
fmt.Stringer
BytesSavedCompression() int
Op() Op
Get(Field) (interface{}, error)
NodeID() ids.NodeID
ExpirationTime() time.Time
OnFinishedHandling()
}
type inboundMessage struct {
op Op
bytesSavedCompression int
nodeID ids.NodeID
expirationTime time.Time
onFinishedHandling func()
}
// Op returns the value of the specified operation in this message
func (inMsg *inboundMessage) Op() Op { return inMsg.op }
// BytesSavedCompression returns the number of bytes this message saved due to
// compression. That is, the number of bytes we did not receive over the
// network due to the message being compressed. 0 for messages that were not
// compressed.
func (inMsg *inboundMessage) BytesSavedCompression() int {
return inMsg.bytesSavedCompression
}
// NodeID returns the node that the msg was sent by.
func (inMsg *inboundMessage) NodeID() ids.NodeID { return inMsg.nodeID }
// ExpirationTime returns the time this message doesn't need to be responded to.
// A zero time means message does not expire.
func (inMsg *inboundMessage) ExpirationTime() time.Time { return inMsg.expirationTime }
// OnFinishedHandling is the function to be called once inboundMessage is
// complete.
func (inMsg *inboundMessage) OnFinishedHandling() {
if inMsg.onFinishedHandling != nil {
inMsg.onFinishedHandling()
}
}
type inboundMessageWithPacker struct {
inboundMessage
fields map[Field]interface{}
}
// Field returns the value of the specified field in this message
func (inMsg *inboundMessageWithPacker) Get(field Field) (interface{}, error) {
value, ok := inMsg.fields[field]
if !ok {
return nil, fmt.Errorf("%w: %s", errMissingField, field)
}
return value, nil
}
func (inMsg *inboundMessageWithPacker) String() string {
sb := strings.Builder{}
sb.WriteString(fmt.Sprintf("(Op: %s, NodeID: %s", inMsg.op, inMsg.nodeID))
if requestIDIntf, exists := inMsg.fields[RequestID]; exists {
sb.WriteString(fmt.Sprintf(", RequestID: %d", requestIDIntf.(uint32)))
}
if !inMsg.expirationTime.IsZero() {
sb.WriteString(fmt.Sprintf(", Deadline: %d", inMsg.expirationTime.Unix()))
}
switch inMsg.op {
case GetAccepted, Accepted, Chits, AcceptedFrontier:
sb.WriteString(fmt.Sprintf(", NumContainerIDs: %d)", len(inMsg.fields[ContainerIDs].([][]byte))))
case Get, GetAncestors, PullQuery:
sb.WriteString(fmt.Sprintf(", ContainerID: 0x%x)", inMsg.fields[ContainerID].([]byte)))
case Ancestors:
sb.WriteString(fmt.Sprintf(", NumContainers: %d)", len(inMsg.fields[MultiContainerBytes].([][]byte))))
case Notify:
sb.WriteString(fmt.Sprintf(", Notification: %d)", inMsg.fields[VMMessage].(uint32)))
case AppRequest, AppResponse, AppGossip:
sb.WriteString(fmt.Sprintf(", len(AppMsg): %d)", len(inMsg.fields[AppBytes].([]byte))))
default:
sb.WriteString(")")
}
return sb.String()
}
type inboundMessageWithProto struct {
inboundMessage
msg *p2ppb.Message
}
func (inMsg *inboundMessageWithProto) String() string {
return inMsg.msg.String()
}
func (inMsg *inboundMessageWithProto) Get(field Field) (interface{}, error) {
return getField(inMsg.msg, field)
}
// TODO: once protobuf-based p2p messaging is fully activated,
// move the semantic checks out of this package
func getField(m *p2ppb.Message, field Field) (interface{}, error) {
switch m.GetMessage().(type) {
case *p2ppb.Message_Pong:
msg := m.GetPong()
if field == Uptime {
// the original packer-based pong base uses uint8
return uint8(msg.UptimePct), nil
}
case *p2ppb.Message_Version:
msg := m.GetVersion()
switch field {
case NetworkID:
return msg.NetworkId, nil
case MyTime:
return msg.MyTime, nil
case IP:
// "net.IP" type in Golang is 16-byte
// regardless of whether it's IPV4 or 6 (see net.IPv6len)
// however, proto message does not enforce the length
// so we need to verify here
// TODO: once we complete the migration
// move this semantic verification outside of this package
if len(msg.IpAddr) != net.IPv6len {
return nil, fmt.Errorf(
"%w: invalid IP address length %d in version message",
errInvalidIPAddrLen,
len(msg.IpAddr),
)
}
return ips.IPPort{
IP: net.IP(msg.IpAddr),
Port: uint16(msg.IpPort),
}, nil
case VersionStr:
return msg.MyVersion, nil
case VersionTime:
return msg.MyVersionTime, nil
case SigBytes:
return msg.Sig, nil
case TrackedSubnets:
return msg.TrackedSubnets, nil
}
case *p2ppb.Message_PeerList:
msg := m.GetPeerList()
if field == Peers {
peers := make([]ips.ClaimedIPPort, len(msg.GetClaimedIpPorts()))
for i, p := range msg.GetClaimedIpPorts() {
tlsCert, err := x509.ParseCertificate(p.X509Certificate)
if err != nil {
// this certificate is different than the certificate received
// during the TLS handshake (and so this error can occur)
return nil, fmt.Errorf(
"%w: failed to parse peer certificate for peer_list message (%v)",
errInvalidCert,
err,
)
}
// TODO: once we complete the migration
// move this semantic verification outside of this package
if len(p.IpAddr) != net.IPv6len {
return nil, fmt.Errorf(
"%w: invalid IP address length %d in peer_list message",
errInvalidIPAddrLen,
len(p.IpAddr),
)
}
peers[i] = ips.ClaimedIPPort{
Cert: tlsCert,
IPPort: ips.IPPort{
IP: net.IP(p.IpAddr),
Port: uint16(p.IpPort),
},
Timestamp: p.Timestamp,
Signature: p.Signature,
}
}
return peers, nil
}
case *p2ppb.Message_GetStateSummaryFrontier:
msg := m.GetGetStateSummaryFrontier()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case Deadline:
return msg.Deadline, nil
}
case *p2ppb.Message_StateSummaryFrontier_:
msg := m.GetStateSummaryFrontier_()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case SummaryBytes:
return msg.Summary, nil
}
case *p2ppb.Message_GetAcceptedStateSummary:
msg := m.GetGetAcceptedStateSummary()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case Deadline:
return msg.Deadline, nil
case SummaryHeights:
return msg.Heights, nil
}
case *p2ppb.Message_AcceptedStateSummary_:
msg := m.GetAcceptedStateSummary_()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case SummaryIDs:
return msg.SummaryIds, nil
}
case *p2ppb.Message_GetAcceptedFrontier:
msg := m.GetGetAcceptedFrontier()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case Deadline:
return msg.Deadline, nil
}
case *p2ppb.Message_AcceptedFrontier_:
msg := m.GetAcceptedFrontier_()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case ContainerIDs:
return msg.ContainerIds, nil
}
case *p2ppb.Message_GetAccepted:
msg := m.GetGetAccepted()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case Deadline:
return msg.Deadline, nil
case ContainerIDs:
return msg.ContainerIds, nil
}
case *p2ppb.Message_Accepted_:
msg := m.GetAccepted_()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case ContainerIDs:
return msg.ContainerIds, nil
}
case *p2ppb.Message_GetAncestors:
msg := m.GetGetAncestors()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case Deadline:
return msg.Deadline, nil
case ContainerID:
return msg.ContainerId, nil
}
case *p2ppb.Message_Ancestors_:
msg := m.GetAncestors_()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case MultiContainerBytes:
return msg.Containers, nil
}
case *p2ppb.Message_Get:
msg := m.GetGet()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case Deadline:
return msg.Deadline, nil
case ContainerID:
return msg.ContainerId, nil
}
case *p2ppb.Message_Put:
msg := m.GetPut()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case ContainerBytes:
return msg.Container, nil
}
case *p2ppb.Message_PushQuery:
msg := m.GetPushQuery()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case Deadline:
return msg.Deadline, nil
case ContainerBytes:
return msg.Container, nil
}
case *p2ppb.Message_PullQuery:
msg := m.GetPullQuery()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case Deadline:
return msg.Deadline, nil
case ContainerID:
return msg.ContainerId, nil
}
case *p2ppb.Message_Chits:
msg := m.GetChits()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case ContainerIDs:
return msg.ContainerIds, nil
}
case *p2ppb.Message_AppRequest:
msg := m.GetAppRequest()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case Deadline:
return msg.Deadline, nil
case AppBytes:
return msg.AppBytes, nil
}
case *p2ppb.Message_AppResponse:
msg := m.GetAppResponse()
switch field {
case ChainID:
return msg.ChainId, nil
case RequestID:
return msg.RequestId, nil
case AppBytes:
return msg.AppBytes, nil
}
case *p2ppb.Message_AppGossip:
msg := m.GetAppGossip()
switch field {
case ChainID:
return msg.ChainId, nil
case AppBytes:
return msg.AppBytes, nil
}
}
return nil, fmt.Errorf("%w: %s", errMissingField, field)
}
// OutboundMessage represents a set of fields for an outbound message that can
// be serialized into a byte stream
type OutboundMessage interface {
BytesSavedCompression() int
Bytes() []byte
Op() Op
BypassThrottling() bool
AddRef()
DecRef()
IsProto() bool
}
type outboundMessage struct {
op Op
bytes []byte
bytesSavedCompression int
bypassThrottling bool
}
// Op returns the value of the specified operation in this message
func (outMsg *outboundMessage) Op() Op { return outMsg.op }
// Bytes returns this message in bytes
func (outMsg *outboundMessage) Bytes() []byte { return outMsg.bytes }
// BytesSavedCompression returns the number of bytes this message saved due to
// compression. That is, the number of bytes we did not send over the
// network due to the message being compressed. 0 for messages that were not
// compressed.
func (outMsg *outboundMessage) BytesSavedCompression() int {
return outMsg.bytesSavedCompression
}
// BypassThrottling when attempting to send this message
func (outMsg *outboundMessage) BypassThrottling() bool { return outMsg.bypassThrottling }
type outboundMessageWithPacker struct {
outboundMessage
refLock sync.Mutex
refs int
c *codec
}
func (outMsg *outboundMessageWithPacker) AddRef() {
outMsg.refLock.Lock()
defer outMsg.refLock.Unlock()
outMsg.refs++
}
// Once the reference count of this message goes to 0, the byte slice should not
// be inspected.
func (outMsg *outboundMessageWithPacker) DecRef() {
outMsg.refLock.Lock()
defer outMsg.refLock.Unlock()
outMsg.refs--
if outMsg.refs == 0 {
outMsg.c.byteSlicePool.Put(outMsg.bytes)
}
}
func (outMsg *outboundMessageWithPacker) IsProto() bool { return false }
type outboundMessageWithProto struct {
outboundMessage
msg *p2ppb.Message
}
func (outMsg *outboundMessageWithProto) AddRef() {}
func (outMsg *outboundMessageWithProto) DecRef() {}
func (outMsg *outboundMessageWithProto) IsProto() bool { return true }
// TODO: add other compression algorithms with extended interface
type msgBuilderProtobuf struct {
gzipCompressor compression.Compressor
clock mockable.Clock
compressTimeMetrics map[Op]metric.Averager
decompressTimeMetrics map[Op]metric.Averager
maxMessageTimeout time.Duration
}
// NOTE: the metrics registration paths are the same as "NewCodecWithMemoryPool"!
// To avoid conflicts, use the different namespace if created at the same time.
func newMsgBuilderProtobuf(namespace string, metrics prometheus.Registerer, maxMessageSize int64, maxMessageTimeout time.Duration) (*msgBuilderProtobuf, error) {
cpr, err := compression.NewGzipCompressor(maxMessageSize)
if err != nil {
return nil, err
}
mb := &msgBuilderProtobuf{
gzipCompressor: cpr,
compressTimeMetrics: make(map[Op]metric.Averager, len(ExternalOps)),
decompressTimeMetrics: make(map[Op]metric.Averager, len(ExternalOps)),
maxMessageTimeout: maxMessageTimeout,
}
errs := wrappers.Errs{}
for _, op := range ExternalOps {
if !op.Compressible() {
continue
}
mb.compressTimeMetrics[op] = metric.NewAveragerWithErrs(
namespace,
fmt.Sprintf("%s_compress_time", op),
fmt.Sprintf("time (in ns) to compress %s messages", op),
metrics,
&errs,
)
mb.decompressTimeMetrics[op] = metric.NewAveragerWithErrs(
namespace,
fmt.Sprintf("%s_decompress_time", op),
fmt.Sprintf("time (in ns) to decompress %s messages", op),
metrics,
&errs,
)
}
return mb, errs.Err
}
// NOTE THAT the passed message must be verified beforehand.
// NOTE THAT the passed message will be modified if compression is enabled.
// TODO: find a way to not in-place modify the message
func (mb *msgBuilderProtobuf) marshal(m *p2ppb.Message, gzipCompress bool) ([]byte, int, time.Duration, error) {
uncompressedMsgBytes, err := proto.Marshal(m)
if err != nil {
return nil, 0, 0, err
}
if !gzipCompress {
return uncompressedMsgBytes, 0, 0, nil
}
// If compression is enabled, we marshal twice:
// 1. the original message
// 2. the message with compressed bytes
//
// This recursive packing allows us to avoid an extra compression on/off
// field in the message.
startTime := time.Now()
compressedBytes, err := mb.gzipCompressor.Compress(uncompressedMsgBytes)
if err != nil {
return nil, 0, 0, err
}
compressTook := time.Since(startTime)
// Original message can be discarded for the compressed message.
m.Message = &p2ppb.Message_CompressedGzip{
CompressedGzip: compressedBytes,
}
compressedMsgBytes, err := proto.Marshal(m)
if err != nil {
return nil, 0, 0, err
}
bytesSaved := len(uncompressedMsgBytes) - len(compressedMsgBytes)
return compressedMsgBytes, bytesSaved, compressTook, nil
}
func (mb *msgBuilderProtobuf) unmarshal(b []byte) (Op, *p2ppb.Message, bool, int, time.Duration, error) {
m := new(p2ppb.Message)
if err := proto.Unmarshal(b, m); err != nil {
return 0, nil, false, 0, 0, err
}
compressed := m.GetCompressedGzip()
if len(compressed) == 0 {
// The message wasn't compressed
op, err := msgToOp(m)
return op, m, false, 0, 0, err
}
startTime := time.Now()
decompressed, err := mb.gzipCompressor.Decompress(compressed)
if err != nil {
return 0, nil, true, 0, 0, err
}
decompressTook := time.Since(startTime)
if err := proto.Unmarshal(decompressed, m); err != nil {
return 0, nil, true, 0, 0, err
}
op, err := msgToOp(m)
bytesSavedCompression := len(decompressed) - len(compressed)
return op, m, true, bytesSavedCompression, decompressTook, err
}
func msgToOp(m *p2ppb.Message) (Op, error) {
switch m.GetMessage().(type) {
case *p2ppb.Message_Ping:
return Ping, nil
case *p2ppb.Message_Pong:
return Pong, nil
case *p2ppb.Message_Version:
return Version, nil
case *p2ppb.Message_PeerList:
return PeerList, nil
case *p2ppb.Message_GetStateSummaryFrontier:
return GetStateSummaryFrontier, nil
case *p2ppb.Message_StateSummaryFrontier_:
return StateSummaryFrontier, nil
case *p2ppb.Message_GetAcceptedStateSummary:
return GetAcceptedStateSummary, nil
case *p2ppb.Message_AcceptedStateSummary_:
return AcceptedStateSummary, nil
case *p2ppb.Message_GetAcceptedFrontier:
return GetAcceptedFrontier, nil
case *p2ppb.Message_AcceptedFrontier_:
return AcceptedFrontier, nil
case *p2ppb.Message_GetAccepted:
return GetAccepted, nil
case *p2ppb.Message_Accepted_:
return Accepted, nil
case *p2ppb.Message_GetAncestors:
return GetAncestors, nil
case *p2ppb.Message_Ancestors_:
return Ancestors, nil
case *p2ppb.Message_Get:
return Get, nil
case *p2ppb.Message_Put:
return Put, nil
case *p2ppb.Message_PushQuery:
return PushQuery, nil
case *p2ppb.Message_PullQuery:
return PullQuery, nil
case *p2ppb.Message_Chits:
return Chits, nil
case *p2ppb.Message_AppRequest:
return AppRequest, nil
case *p2ppb.Message_AppResponse:
return AppResponse, nil
case *p2ppb.Message_AppGossip:
return AppGossip, nil
default:
return 0, fmt.Errorf("%w: unknown message %T", errUnknownMessageTypeForOp, m.GetMessage())
}
}
// NOTE THAT the passed message will be updated if compression is enabled.
// TODO: find a way to not in-place modify the message
func (mb *msgBuilderProtobuf) createOutbound(op Op, msg *p2ppb.Message, gzipCompress bool, bypassThrottling bool) (*outboundMessageWithProto, error) {
b, saved, compressTook, err := mb.marshal(msg, gzipCompress)
if err != nil {
return nil, err
}
if gzipCompress {
mb.compressTimeMetrics[op].Observe(float64(compressTook))
}
return &outboundMessageWithProto{
outboundMessage: outboundMessage{
op: op,
bytes: b,
bytesSavedCompression: saved,
bypassThrottling: bypassThrottling,
},
msg: msg,
}, nil
}
func (mb *msgBuilderProtobuf) parseInbound(bytes []byte, nodeID ids.NodeID, onFinishedHandling func()) (*inboundMessageWithProto, error) {
op, m, wasCompressed, bytesSavedCompression, decompressTook, err := mb.unmarshal(bytes)
if err != nil {
return nil, err
}
if wasCompressed {
mb.decompressTimeMetrics[op].Observe(float64(decompressTook))
}
var expirationTime time.Time
if deadline, err := getField(m, Deadline); err == nil {
deadlineDuration := time.Duration(deadline.(uint64))
if deadlineDuration > mb.maxMessageTimeout {
deadlineDuration = mb.maxMessageTimeout
}
expirationTime = mb.clock.Time().Add(deadlineDuration)
}
return &inboundMessageWithProto{
inboundMessage: inboundMessage{
op: op,
bytesSavedCompression: bytesSavedCompression,
nodeID: nodeID,
expirationTime: expirationTime,
onFinishedHandling: onFinishedHandling,
},
msg: m,
}, nil
}