Comments (5)
I can confirm this problem on OSX. The problem does not occur on Linux.
Looks like the io_context returns immediately without waiting for pending operations, so the multiplexer destructor complains about those.
from trial.datagram.
Further investigation shows that the async_receive_from()
with message_peek
in multiplexer::do_start_receive()
triggers the callback immediately, rather than when an incoming datagram has arrived.
from trial.datagram.
Ah ah, yes, that's it, I remember facing that very same issue in a little POC I did. Somehow macOS does not like it if you pass it an empty buffer for the peek. I had to create a one byte peek_
buffer just for that:
socket_.async_receive_from(net::buffer(peek_), remote_endpoint_, net::socket_base::message_peek, [this](lib::error_code ec, std::size_t) {
if (ec) {
std::cerr << "UDP Accept error: " << ec.message() << "\n";
return;
}
std::cout << "Accepted! local=" << socket_.local_endpoint() << " remote=" << remote_endpoint_ << "\n";
socket_.connect(remote_endpoint_);
std::make_shared<Session>(std::move(socket_))->Start();
DoAccept();
});
}
std::uint16_t port_;
udp::socket socket_;
udp::endpoint remote_endpoint_;
std::array<char, 1> peek_;
You may know of a better way to solve this..
Unless you can fix it fast, I'll try to submit a PR when I get to it. thanks!
from trial.datagram.
Thanks, that works.
Committed in 24f3a90
from trial.datagram.
You da man! Thanks! it works.
from trial.datagram.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trial.datagram.