• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

libbitcoin / libbitcoin-network / 44447581389

19 Nov 2026 02:53AM UTC coverage: 94.065% (-0.002%) from 94.067%
44447581389

push

github

web-flow
Merge pull request #1049 from evoskuil/master

Hold small socket writes while more are queued, written as one.

103 of 112 new or added lines in 13 files covered. (91.96%)

1 existing line in 1 file now uncovered.

16104 of 17120 relevant lines covered (94.07%)

2221.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.19
/src/net/socket.cpp
1
/**
2
 * Copyright (c) 2011-2026 libbitcoin developers
3
 *
4
 * This file is part of libbitcoin.
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Affero General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU Affero General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Affero General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
#include <bitcoin/network/net/socket.hpp>
20

21
#include <bitcoin/network/async/async.hpp>
22
#include <bitcoin/network/config/config.hpp>
23
#include <bitcoin/network/define.hpp>
24
#include <bitcoin/network/log/log.hpp>
25
#include <bitcoin/network/net/deadline.hpp>
26

27
// Async operations are not thread safe for the same socket object.
28
// Calls are stranded to protect the socket member.
29

30
namespace libbitcoin {
31
namespace network {
32

33
using namespace system;
34
using namespace std::placeholders;
35

36
// Shared pointers required in handler parameters so closures control lifetime.
37
BC_PUSH_WARNING(NO_VALUE_OR_CONST_REF_SHARED_PTR)
38
BC_PUSH_WARNING(SMART_PTR_NOT_NEEDED)
39
BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
40

41
// Bounds query overrun following caller drop, not response latency.
42
constexpr auto watch_interval = milliseconds(10);
43

44
// Construct.
45
// ----------------------------------------------------------------------------
46

47
socket::socket(const logger& log, io::context& service,
411 ✔
48
    const parameters& parameters, bool proxied) NOEXCEPT
411 ✔
49
  : socket(log, service, parameters, {}, {}, proxied, true)
411 ✔
50
{
51
}
411 ✔
52

53
socket::socket(const logger& log, io::context& service,
135 ✔
54
    const parameters& params, const config::address& address,
55
    const config::endpoint& endpoint, bool proxied) NOEXCEPT
135 ✔
56
  : socket(log, service, params, address, endpoint, proxied, false)
135 ✔
57
{
58
}
135 ✔
59

60
// protected
61
socket::socket(const logger& log, io::context& service,
546 ✔
62
    const parameters& params, const config::address& address,
63
    const config::endpoint& endpoint, bool proxied, bool inbound) NOEXCEPT
546 ✔
64
  : reporter(log),
65
    tracker<socket>(log),
66
    inbound_(inbound),
546 ✔
67
    proxied_(proxied),
546 ✔
68
    maximum_(params.maximum_request),
546 ✔
69
    header_(std::min(params.maximum_request, maximum_http_header)),
546 ✔
70
    minimum_buffer_(params.minimum_buffer),
546 ✔
71
    bind_(params.bind),
546 ✔
72
    slot_(params.slot),
546 ✔
73
    strand_(service.get_executor()),
546 ✔
74
    service_(service),
546 ✔
75
    context_(params.context),
546 ✔
76
    role_(params.role),
546 ✔
77
    address_(address),
546 ✔
78
    endpoint_(endpoint),
546 ✔
79
    timer_(emplace_shared<deadline>(log, strand_, params.connect_timeout)),
546 ✔
80
    watch_(emplace_shared<deadline>(log, strand_, watch_interval)),
546 ✔
81
    socket_(std::in_place_type<io::socket>, strand_),
546 ✔
82
    response_(params.maximum_buffer)
2,184 ✔
83
{
84
}
546 ✔
85

86
socket::~socket() NOEXCEPT
546 ✔
87
{
88
    BC_ASSERT_MSG(stopped(), "socket is not stopped");
546 ✔
89
    if (!stopped_.load()) { LOGF("~socket is not stopped."); }
546 ✔
90
}
546 ✔
91

92
// Wait.
93
// ----------------------------------------------------------------------------
94

95
void socket::watch(result_handler&& handler) NOEXCEPT
18 ✔
96
{
97
    io::dispatch(strand_,
18 ✔
98
        std::bind(&socket::do_watch,
36 ✔
99
            shared_from_this(), std::move(handler)));
36 ✔
100
}
18 ✔
101

102
void socket::poll(result_handler&& handler) NOEXCEPT
3 ✔
103
{
104
    io::dispatch(strand_,
3 ✔
105
        std::bind(&socket::do_poll,
6 ✔
106
            shared_from_this(), std::move(handler)));
6 ✔
107
}
3 ✔
108

109
// private
110
void socket::do_watch(const result_handler& handler) NOEXCEPT
21 ✔
111
{
112
    BC_ASSERT(stranded());
21 ✔
113

114
    if (stopped_.load())
21 ✔
115
    {
116
        handler(error::success);
×
117
        return;
×
118
    }
119

120
    watch_->start(std::bind(&socket::handle_watch,
21 ✔
121
        shared_from_this(), _1, handler));
42 ✔
122
}
123

124
// private
125
void socket::do_poll(const result_handler& handler) NOEXCEPT
3 ✔
126
{
127
    BC_ASSERT(stranded());
3 ✔
128

129
    if (stopped_.load())
3 ✔
130
    {
131
        handler(error::success);
1 ✔
132
        return;
1 ✔
133
    }
134

135
    watch_->start(std::bind(&socket::handle_poll,
2 ✔
136
        shared_from_this(), _1, handler));
4 ✔
137
}
138

139
// private
140
void socket::handle_watch(const code& ec,
21 ✔
141
    const result_handler& handler) NOEXCEPT
142
{
143
    BC_ASSERT(stranded());
21 ✔
144

145
    // Only timer stop results in caller not stopping the channel.
146
    if (ec)
21 ✔
147
    {
148
        handler(error::success);
17 ✔
149
        return;
17 ✔
150
    }
151

152
    if (get_base().half_closed())
4 ✔
153
    {
154
        handler(error::peer_disconnect);
1 ✔
155
        return;
1 ✔
156
    }
157

158
    do_watch(handler);
3 ✔
159
}
160

161
// private
162
void socket::handle_poll(const code& ec,
2 ✔
163
    const result_handler& handler) NOEXCEPT
164
{
165
    BC_ASSERT(stranded());
2 ✔
166

167
    // Timer stop (socket stop) results in caller not stopping the channel.
168
    if (!ec && get_base().half_closed())
2 ✔
169
    {
170
        handler(error::peer_disconnect);
1 ✔
171
        return;
1 ✔
172
    }
173

174
    handler(error::success);
1 ✔
175
}
176

177
// Properties.
178
// ----------------------------------------------------------------------------
179

180
io::context& socket::service() const NOEXCEPT
2 ✔
181
{
182
    return service_;
2 ✔
183
}
184

185
io::strand& socket::strand() NOEXCEPT
3,194 ✔
186
{
187
    return strand_;
3,194 ✔
188
}
189

190
bool socket::stranded() const NOEXCEPT
410,305 ✔
191
{
192
    return strand_.running_in_this_thread();
410,305 ✔
193
}
194

195
bool socket::stopped() const NOEXCEPT
83,477 ✔
196
{
197
    return stopped_.load();
83,477 ✔
198
}
199

200
bool socket::inbound() const NOEXCEPT
793 ✔
201
{
202
    return inbound_;
793 ✔
203
}
204

205
bool socket::websocket() const NOEXCEPT
77,945 ✔
206
{
207
    return websocket_.load();
77,945 ✔
208
}
209

210
bool socket::downgraded() const NOEXCEPT
188 ✔
211
{
212
    return downgraded_.load();
188 ✔
213
}
214

215
bool socket::detected() const NOEXCEPT
71 ✔
216
{
217
    return detected_.load();
71 ✔
218
}
219

220
const config::address& socket::address() const NOEXCEPT
314 ✔
221
{
222
    return address_;
314 ✔
223
}
224

225
const config::endpoint& socket::endpoint() const NOEXCEPT
330 ✔
226
{
227
    return endpoint_;
330 ✔
228
}
229

230
const config::endpoint& socket::binding() const NOEXCEPT
9 ✔
231
{
232
    return binding_;
9 ✔
233
}
234

235
size_t socket::slot() const NOEXCEPT
4 ✔
236
{
237
    return slot_;
4 ✔
238
}
239

240
void socket::set_address(const config::address& address) NOEXCEPT
2 ✔
241
{
242
    BC_ASSERT(stranded());
2 ✔
243
    address_ = address;
2 ✔
244
    endpoint_ = address;
2 ✔
245
}
2 ✔
246

247
// Variant state (protected by strand).
248
// ----------------------------------------------------------------------------
249

250
bool socket::secure() const NOEXCEPT
40 ✔
251
{
252
    BC_ASSERT(stranded());
40 ✔
253
    return std::holds_alternative<tls::stream>(socket_);
40 ✔
254
}
255

256
bool socket::encrypted() const NOEXCEPT
1,032 ✔
257
{
258
    BC_ASSERT(stranded());
1,032 ✔
259
    return std::holds_alternative<p2ps::stream>(socket_);
1,032 ✔
260
}
261

262
bool socket::zeromq() const NOEXCEPT
326 ✔
263
{
264
    BC_ASSERT(stranded());
326 ✔
265
    return std::holds_alternative<zmtp::stream>(socket_);
326 ✔
266
}
267

268
// protected
269
bool socket::is_base() const NOEXCEPT
1 ✔
270
{
271
    BC_ASSERT(stranded());
1 ✔
272
    return std::holds_alternative<io::socket>(socket_);
1 ✔
273
}
274

275
// Variant accessors.
276
// ----------------------------------------------------------------------------
277
// protected
278

279
socket::tcp_t socket::get_tcp() NOEXCEPT
76,966 ✔
280
{
281
    BC_ASSERT(stranded());
76,966 ✔
282

283
    return std::visit(overload
153,932 ✔
284
    {
285
        [](io::socket& value) NOEXCEPT -> socket::tcp_t
76,957 ✔
286
        {
287
            return std::ref(value);
76,957 ✔
288
        },
289
        [](tls::stream& value) NOEXCEPT -> socket::tcp_t
9 ✔
290
        {
291
            return std::ref(value);
9 ✔
292
        },
293
        [](p2ps::stream&) NOEXCEPT -> socket::tcp_t
×
294
        {
295
            std::terminate();
×
296
        },
297
        [](zmtp::stream&) NOEXCEPT -> socket::tcp_t
×
298
        {
299
            std::terminate();
×
300
        }
301
    }, socket_);
76,966 ✔
302
}
303

304
io::socket& socket::get_base() NOEXCEPT
2,673 ✔
305
{
306
    return std::visit(overload
5,346 ✔
307
    {
308
        [](io::socket& value) NOEXCEPT -> io::socket&
2,614 ✔
309
        {
310
            return value;
2,614 ✔
311
        },
312
        [](tls::stream& value) NOEXCEPT -> io::socket&
12 ✔
313
        {
314
            return value.next_layer();
12 ✔
315
        },
316
        [](p2ps::stream& value) NOEXCEPT -> io::socket&
4 ✔
317
        {
318
            return value.next_layer();
4 ✔
319
        },
320
        [](zmtp::stream& value) NOEXCEPT -> io::socket&
43 ✔
321
        {
322
            return value.next_layer();
43 ✔
323
        }
324
    }, socket_);
2,673 ✔
325
}
326

327
tls::stream& socket::get_tls() NOEXCEPT
×
328
{
329
    BC_ASSERT(stranded());
×
330
    BC_ASSERT(secure());
×
331

332
    return std::visit(overload
×
333
    {
334
        [](io::socket&) NOEXCEPT -> tls::stream&
×
335
        {
336
            std::terminate();
×
337
        },
338
        [](tls::stream& value) NOEXCEPT -> tls::stream&
×
339
        {
340
            return value;
×
341
        },
342
        [](p2ps::stream&) NOEXCEPT -> tls::stream&
×
343
        {
344
            std::terminate();
×
345
        },
346
        [](zmtp::stream&) NOEXCEPT -> tls::stream&
×
347
        {
348
            std::terminate();
×
349
        }
350
    }, socket_);
×
351
}
352

353
p2ps::stream& socket::get_p2ps() NOEXCEPT
8 ✔
354
{
355
    BC_ASSERT(stranded());
8 ✔
356
    BC_ASSERT(encrypted());
8 ✔
357

358
    return std::visit(overload
16 ✔
359
    {
360
        [](io::socket&) NOEXCEPT -> p2ps::stream&
×
361
        {
362
            std::terminate();
×
363
        },
364
        [](tls::stream&) NOEXCEPT -> p2ps::stream&
×
365
        {
366
            std::terminate();
×
367
        },
368
        [](p2ps::stream& value) NOEXCEPT -> p2ps::stream&
8 ✔
369
        {
370
            return value;
8 ✔
371
        },
372
        [](zmtp::stream&) NOEXCEPT -> p2ps::stream&
×
373
        {
374
            std::terminate();
×
375
        }
376
    }, socket_);
8 ✔
377
}
378

379
zmtp::stream& socket::get_zmtp() NOEXCEPT
94 ✔
380
{
381
    BC_ASSERT(stranded());
94 ✔
382
    BC_ASSERT(zeromq());
94 ✔
383

384
    return std::visit(overload
188 ✔
385
    {
386
        [](io::socket&) NOEXCEPT -> zmtp::stream&
×
387
        {
388
            std::terminate();
×
389
        },
390
        [](tls::stream&) NOEXCEPT -> zmtp::stream&
×
391
        {
392
            std::terminate();
×
393
        },
394
        [](p2ps::stream&) NOEXCEPT -> zmtp::stream&
×
395
        {
396
            std::terminate();
×
397
        },
398
        [](zmtp::stream& value) NOEXCEPT -> zmtp::stream&
94 ✔
399
        {
400
            return value;
94 ✔
401
        }
402
    }, socket_);
94 ✔
403
}
404

405
// Variant (ws vs. tcp)  helpers.
406
// ----------------------------------------------------------------------------
407
// protected
408

409
// write message frame (ws, finish closes the message) or unframed fixed
410
// size bytes (tcp). The binary/text setting applies only at the start of a
411
// message, so it is harmless to pass it on every frame of the message.
412
void socket::async_write(const io::const_buffer& buffer, bool binary,
123 ✔
413
    bool finish, const count_handler& handler) NOEXCEPT
414
{
415
    BC_ASSERT(stranded());
123 ✔
416

417
    if (websocket())
123 ✔
418
    {
419
        ws_send_data(buffer, binary, finish, handler);
1 ✔
420
    }
421
    else
422
    {
423
        transmit({ &buffer, one }, finish,
122 ✔
424
            std::bind(&socket::handle_async,
244 ✔
425
                shared_from_this(), _1, _2, handler, "async_write"));
244 ✔
426
    }
427
}
123 ✔
428

429
// Transport (write).
430
// ----------------------------------------------------------------------------
431
// Writes are issued one at a time, a write issued over another deferred to
432
// its completion. The retained buffer is not prepared while a write of its
433
// bytes is in progress.
434

435
void socket::hold(bool enable) NOEXCEPT
490 ✔
436
{
437
    BC_ASSERT(stranded());
490 ✔
438
    hold_ = enable;
490 ✔
439
}
490 ✔
440

441
bool socket::holding() const NOEXCEPT
422 ✔
442
{
443
    BC_ASSERT(stranded());
422 ✔
444
    return !is_zero(response_.size());
422 ✔
445
}
446

447
void socket::release(count_handler&& handler) NOEXCEPT
2 ✔
448
{
449
    BC_ASSERT(stranded());
2 ✔
450
    hold_ = false;
2 ✔
451
    transmit({}, false, handler);
2 ✔
452
}
2 ✔
453

454
// protected
455
// The write is preceded by the held writes, or is held (if hold) with them.
456
void socket::transmit(const std::span<const io::const_buffer>& buffers,
776 ✔
457
    bool hold, const count_handler& handler) NOEXCEPT
458
{
459
    BC_ASSERT(stranded());
776 ✔
460

461
    if (sending_)
776 ✔
462
    {
NEW
463
        deferred_ = std::bind(&socket::transmit, shared_from_this(),
×
NEW
464
            io::to_buffers<io::const_buffer>(buffers), hold, handler);
×
465
        return;
6 ✔
466
    }
467

468
    const auto held = response_.size();
776 ✔
469
    const auto size = io::buffer_size(buffers);
776 ✔
470
    const auto bound = std::min(minimum_buffer_, response_.max_size());
776 ✔
471
    if (hold && hold_ && size <= floored_subtract(bound, held))
776 ✔
472
    {
473
        response_.append(buffers);
6 ✔
474
        io::post(strand_, std::bind(handler, error::success, size));
6 ✔
475
        return;
6 ✔
476
    }
477

478
    io::const_buffers gather{};
770 ✔
479
    if (!is_zero(held))
770 ✔
480
        gather.push_back(response_.cdata());
6 ✔
481

482
    gather.insert(gather.end(), buffers.begin(), buffers.end());
770 ✔
483
    response_.clear();
770 ✔
484
    sending_ = true;
770 ✔
485
    VARIANT_DISPATCH_FUNCTION(io::async_write, get_tcp(),
1,540 ✔
486
        gather, std::bind(&socket::handle_transmit,
487
            shared_from_this(), _1, _2, held, handler));
488
}
770 ✔
489

490
// protected
491
// The write is independent of the held writes.
492
void socket::interject(const std::span<const io::const_buffer>& buffers,
4 ✔
493
    const count_handler& handler) NOEXCEPT
494
{
495
    BC_ASSERT(stranded());
4 ✔
496

497
    if (sending_)
4 ✔
498
    {
NEW
499
        deferred_ = std::bind(&socket::interject, shared_from_this(),
×
NEW
500
            io::to_buffers<io::const_buffer>(buffers), handler);
×
NEW
501
        return;
×
502
    }
503

504
    sending_ = true;
4 ✔
505
    VARIANT_DISPATCH_FUNCTION(io::async_write, get_tcp(),
8 ✔
506
        buffers, std::bind(&socket::handle_transmit,
507
            shared_from_this(), _1, _2, zero, handler));
508
}
509

510
// private
511
// The size reported excludes that of the held writes (reported when held).
512
void socket::handle_transmit(const code& ec, size_t size, size_t held,
774 ✔
513
    const count_handler& handler) NOEXCEPT
514
{
515
    BC_ASSERT(stranded());
774 ✔
516

517
    sending_ = false;
774 ✔
518
    const auto next = std::exchange(deferred_, {});
774 ✔
519
    handler(ec, floored_subtract(size, held));
774 ✔
520

521
    if (next)
774 ✔
NEW
522
        next();
×
523
}
774 ✔
524

525
// read arbitrary tcp bytes, iterate (up to buffer capacity).
526
void socket::async_read_some(const io::mutable_buffer& buffer,
124 ✔
527
    const count_handler& handler) NOEXCEPT
528
{
529
    BC_ASSERT(stranded());
124 ✔
530

531
    if (websocket())
124 ✔
532
    {
533
        // Websockets read messages, use async_read(flat_buffer).
534
        handler(error::operation_failed, {});
×
535
    }
536
    else
537
    {
538
        VARIANT_DISPATCH_METHOD(get_tcp(),
248 ✔
539
            async_read_some(buffer, std::bind(&socket::handle_async,
540
                shared_from_this(), _1, _2, handler, "async_read_some")));
541
    }
542
}
124 ✔
543

544
// read arbitrary tcp bytes, iterate (up to buffer capacity).
545
// read whole ws message in any number of frames (up to buffer capacity).
546
void socket::async_read(http::flat_buffer& buffer,
39 ✔
547
    const count_handler& handler) NOEXCEPT
548
{
549
    BC_ASSERT(stranded());
39 ✔
550

551
    try
552
    {
553
        if (websocket())
39 ✔
554
        {
555
            buffer.consume(buffer.size());
13 ✔
556
            do_ws_read_message(std::ref(buffer), handler);
13 ✔
557
        }
558
        else
559
        {
560
            auto remain = floored_subtract(buffer.max_size(), buffer.size());
26 ✔
561
            if (is_zero(remain))
26 ✔
562
            {
563
                handler(error::buffer_overflow, {});
1 ✔
564
                return;
1 ✔
565
            }
566

567
            VARIANT_DISPATCH_METHOD(get_tcp(),
50 ✔
568
                async_read_some(buffer.prepare(remain),
569
                    std::bind(&socket::handle_async, shared_from_this(),
570
                    _1, _2, handler, "async_read_some")));
571
        }
572
    }
573
    catch (const std::exception& e)
×
574
    {
575
        LOGF("Exception @ async_read: " << e.what());
×
576
        handler(error::operation_failed, {});
×
577
    }
×
578
}
579

580
// read tcp fixed count of bytes (waits until mutable buffer is filled).
581
void socket::async_read(const io::mutable_buffer& buffer,
76,002 ✔
582
    const count_handler& handler) NOEXCEPT
583
{
584
    BC_ASSERT(stranded());
76,002 ✔
585

586
    if (websocket())
76,002 ✔
587
    {
588
        // Websockets read frame not size, use async_read(flat_buffer).
589
        handler(error::operation_failed, {});
1 ✔
590
    }
591
    else
592
    {
593
        // Fixed-size semantics.
594
        VARIANT_DISPATCH_FUNCTION(io::async_read, get_tcp(),
152,002 ✔
595
            buffer, std::bind(&socket::handle_async,
596
                shared_from_this(), _1, _2, handler, "async_read"));
597
    }
598
}
76,002 ✔
599

600
void socket::async_read_http(http::flat_buffer& buffer, http::request& request,
26 ✔
601
    const count_handler& handler) NOEXCEPT
602
{
603
    BC_ASSERT(stranded());
26 ✔
604

605
    if (websocket())
26 ✔
606
    {
607
        // The body reader processes a websocket read just like an http
608
        // read but without the headers. The expected body type (parser)
609
        // must be preselected on the request object.
610
        body_read(buffer, request, move_copy(handler));
8 ✔
611
    }
612
    else
613
    {
614
        const auto parser = to_shared<http_parser>();
18 ✔
615
        parser->body_limit(maximum_);
18 ✔
616
        parser->header_limit(header_);
18 ✔
617
        do_parse(std::ref(buffer), parser, parse_mode::all, zero,
18 ✔
618
            std::bind(&socket::handle_http_read,
36 ✔
619
                shared_from_this(), _1, _2, std::ref(request), parser,
36 ✔
620
                handler));
621
    }
18 ✔
622
}
26 ✔
623

624
void socket::async_write_http(http::response&& response,
40 ✔
625
    const count_handler& handler) NOEXCEPT
626
{
627
    BC_ASSERT(stranded());
40 ✔
628
    assign_buffer(response.body());
40 ✔
629

630
    if (websocket())
40 ✔
631
    {
632
        // The body writer processes a websocket write just like an http
633
        // write but without the headers. The expected body type
634
        // (serializer) is determined by caller-assigned body.
635
        body_write(std::move(response), move_copy(handler));
6 ✔
636
    }
637
    else
638
    {
639
        const auto out = emplace_shared<serialize_state<http_serializer>>(
640
            std::move(response));
34 ✔
641

642
        do_serialize(out, zero,
34 ✔
643
            std::bind(&socket::handle_http_write,
68 ✔
644
                shared_from_this(), _1, _2, handler));
68 ✔
645
    }
34 ✔
646
}
40 ✔
647

648
// Handlers.
649
// ----------------------------------------------------------------------------
650

651
// private
652
void socket::handle_async(const code& ec, size_t size,
76,284 ✔
653
    const count_handler& handler, const std::string& operation) NOEXCEPT
654
{
655
    BC_ASSERT(stranded());
76,284 ✔
656

657
    if (ec == error::operation_canceled)
76,284 ✔
658
    {
659
        handler(error::channel_stopped, size);
28 ✔
660
        return;
28 ✔
661
    }
662

663

664
    if (ec == error::unknown)
76,256 ✔
665
        logx(operation, ec);
×
666

667
    handler(ec, size);
76,256 ✔
668
}
669

670
// Logging.
671
// ----------------------------------------------------------------------------
672
// private
673

674
void socket::logx(const std::string& context,
×
675
    const code& ec) const NOEXCEPT
676
{
677
    LOGX("Socket " << context << " error (" << ec.value() << ") "
×
678
        << ec.category().name() << " : " << ec.message());
679
}
×
680

681
BC_POP_WARNING()
682
BC_POP_WARNING()
683
BC_POP_WARNING()
684

685
} // namespace network
686
} // namespace libbitcoin
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc