aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/actors/interconnect/packet.cpp
blob: 9ba173e3302e1308093ef42ea65d37c805fd4d6d (plain) (blame)
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
#include "packet.h"

#include <library/cpp/actors/core/probes.h>

#include <util/system/datetime.h>

LWTRACE_USING(ACTORLIB_PROVIDER);

ui32 TEventHolder::Fill(IEventHandle& ev) {
    Serial = 0;
    Descr.Type = ev.Type;
    Descr.Flags = ev.Flags;
    Descr.Recipient = ev.Recipient;
    Descr.Sender = ev.Sender;
    Descr.Cookie = ev.Cookie;
    ForwardRecipient = ev.GetForwardOnNondeliveryRecipient();
    EventActuallySerialized = 0;
    Descr.Checksum = 0;

    if (ev.HasBuffer()) {
        Buffer = ev.ReleaseChainBuffer();
        EventSerializedSize = Buffer->GetSize();
    } else if (ev.HasEvent()) {
        Event.Reset(ev.ReleaseBase());
        EventSerializedSize = Event->CalculateSerializedSize();
    } else {
        EventSerializedSize = 0;
    }

    return EventSerializedSize;
}