Commit 524cb5b5 authored by Ian Roddis's avatar Ian Roddis

Merge branch 'master' of ssh://github.com/oktal/pistache into dynamic_arraybuf

parents 0d9cf747 d5608a1c
...@@ -164,6 +164,7 @@ Transport::handlePeerDisconnection(const std::shared_ptr<Peer>& peer) { ...@@ -164,6 +164,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);
} }
...@@ -195,7 +196,7 @@ Transport::asyncWriteImpl( ...@@ -195,7 +196,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;
...@@ -231,7 +232,9 @@ Transport::asyncWriteImpl( ...@@ -231,7 +232,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