Branch data Line data Source code
1 : : /*
2 : : * Copyright 2025 Jinwoo Sung
3 : : *
4 : : * Licensed under the Apache License, Version 2.0 (the "License");
5 : : * you may not use this file except in compliance with the License.
6 : : * You may obtain a copy of the License at
7 : : *
8 : : * http://www.apache.org/licenses/LICENSE-2.0
9 : : *
10 : : * Unless required by applicable law or agreed to in writing, software
11 : : * distributed under the License is distributed on an "AS IS" BASIS,
12 : : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 : : * See the License for the specific language governing permissions and
14 : : * limitations under the License.
15 : : */
16 : :
17 : : #pragma once
18 : :
19 : : #include <cstdint>
20 : : #include <optional>
21 : :
22 : : #include "wirestead/wrapper/send_result.hpp"
23 : :
24 : : namespace wirestead::transport::detail {
25 : : // Owned by every waiter that pinned this connection, even after replacement.
26 : : // The transport submission mutex guards ended_by and every call to end().
27 : : struct UdsWriteWait {
28 : 379 : explicit UdsWriteWait(uint64_t value) : sequence(value) {}
29 : : const uint64_t sequence;
30 : : std::optional<wrapper::SendRejection> ended_by;
31 : :
32 : 868 : void end(wrapper::SendRejection reason) {
33 [ + + ]: 868 : if (!ended_by) ended_by = reason;
34 : 868 : }
35 : : };
36 : : } // namespace wirestead::transport::detail
|