Skip to content

Commit 40e16b5

Browse files
committed
src: format tcp_wrap.cc with clang-format
Signed-off-by: Matteo Collina <hello@matteocollina.com>
1 parent 81d897b commit 40e16b5

1 file changed

Lines changed: 10 additions & 18 deletions

File tree

src/tcp_wrap.cc

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -405,20 +405,17 @@ std::unique_ptr<worker::TransferData> TCPWrap::TransferForMessaging() {
405405
CHECK_NE(GetTransferMode(), TransferMode::kDisallowCloneAndTransfer);
406406

407407
uv_os_fd_t fd;
408-
if (uv_fileno(reinterpret_cast<uv_handle_t*>(&handle_), &fd) != 0)
409-
return {};
408+
if (uv_fileno(reinterpret_cast<uv_handle_t*>(&handle_), &fd) != 0) return {};
410409

411410
// dup() the descriptor so the receiving event loop owns an independent
412411
// reference to the same socket. We then close the source handle, which
413412
// renders it unusable on this side (true transfer semantics) while the dup
414413
// keeps the underlying socket alive for the destination thread.
415414
int dup_fd = dup(fd);
416-
if (dup_fd < 0)
417-
return {};
415+
if (dup_fd < 0) return {};
418416

419-
SocketType type = provider_type() == ProviderType::PROVIDER_TCPSERVERWRAP
420-
? SERVER
421-
: SOCKET;
417+
SocketType type =
418+
provider_type() == ProviderType::PROVIDER_TCPSERVERWRAP ? SERVER : SOCKET;
422419

423420
// Stop watching the fd and tear down the source handle.
424421
Close();
@@ -444,25 +441,20 @@ BaseObjectPtr<BaseObject> TCPWrap::TransferData::Deserialize(
444441
// Construct a fresh TCPWrap in the receiving Environment. We cannot use
445442
// TCPWrap::Instantiate() here because it requires a parent AsyncWrap to
446443
// establish the async_hooks trigger id, and a deserialized handle has none.
447-
if (env->tcp_constructor_template().IsEmpty())
448-
return {};
444+
if (env->tcp_constructor_template().IsEmpty()) return {};
449445
Local<Function> constructor;
450-
if (!env->tcp_constructor_template()
451-
->GetFunction(context)
452-
.ToLocal(&constructor)) {
446+
if (!env->tcp_constructor_template()->GetFunction(context).ToLocal(
447+
&constructor)) {
453448
return {};
454449
}
455450
Local<Value> type_arg = Int32::New(env->isolate(), type_);
456451
Local<Object> obj;
457-
if (!constructor->NewInstance(context, 1, &type_arg).ToLocal(&obj))
458-
return {};
452+
if (!constructor->NewInstance(context, 1, &type_arg).ToLocal(&obj)) return {};
459453

460454
TCPWrap* wrap = BaseObject::Unwrap<TCPWrap>(obj);
461-
if (wrap == nullptr)
462-
return {};
455+
if (wrap == nullptr) return {};
463456

464-
if (uv_tcp_open(&wrap->handle_, fd_) != 0)
465-
return {};
457+
if (uv_tcp_open(&wrap->handle_, fd_) != 0) return {};
466458

467459
wrap->set_fd(fd_);
468460
fd_ = -1; // Ownership has been handed to the new handle.

0 commit comments

Comments
 (0)