Unverified Commit d5608a1c authored by Dennis Jenkins's avatar Dennis Jenkins Committed by GitHub

Merge pull request #291 from iroddis/defer_type_mismatch

Adding a static cast to fix type mismatch that results in a BadType e…
parents 2d24c570 9650c229
...@@ -168,6 +168,7 @@ Transport::handlePeerDisconnection(const std::shared_ptr<Peer>& peer) { ...@@ -168,6 +168,7 @@ Transport::handlePeerDisconnection(const std::shared_ptr<Peer>& peer) {
throw std::runtime_error("Could not find peer to erase"); throw std::runtime_error("Could not find peer to erase");
peers.erase(it); peers.erase(it);
toWrite.erase(fd);
close(fd); close(fd);
} }
...@@ -199,7 +200,7 @@ Transport::asyncWriteImpl( ...@@ -199,7 +200,7 @@ Transport::asyncWriteImpl(
if (buffer.isRaw()) { if (buffer.isRaw()) {
auto raw = buffer.raw(); auto raw = buffer.raw();
auto ptr = raw.data + totalWritten; auto ptr = raw.data + totalWritten;
bytesWritten = ::send(fd, ptr, len, flags); bytesWritten = ::send(fd, ptr, len, flags | MSG_NOSIGNAL);
} else { } else {
auto file = buffer.fd(); auto file = buffer.fd();
off_t offset = totalWritten; off_t offset = totalWritten;
...@@ -235,7 +236,9 @@ Transport::asyncWriteImpl( ...@@ -235,7 +236,9 @@ Transport::asyncWriteImpl(
::close(buffer.fd()); ::close(buffer.fd());
} }
deferred.resolve(totalWritten); // Cast to match the type of defered template
// to avoid a BadType exception
deferred.resolve(static_cast<ssize_t>(totalWritten));
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment