We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c69444e commit bf56658Copy full SHA for bf56658
src/socket.cpp
@@ -233,17 +233,20 @@ namespace dap {
233
Socket::Socket(const char* address, const char* port)
234
: shared(Shared::create(address, port)) {
235
if (shared) {
236
+ bool failed = false;
237
shared->lock([&](SOCKET socket, const addrinfo* info) {
238
if (bind(socket, info->ai_addr, (int)info->ai_addrlen) != 0) {
- shared.reset();
239
+ failed = true;
240
return;
241
}
242
243
if (listen(socket, 0) != 0) {
244
245
246
247
});
248
+ if (failed)
249
+ shared.reset();
250
251
252
0 commit comments