Skip to content

Commit

Permalink
datatransfer: fix io error during write op
Browse files Browse the repository at this point in the history
io error in endpoint write operation was not handled.
Add this by this patch and fixes write issues (ex, when peer disconnect).

Change-Id: I24dada649f4d9f9627d2d2ff8efcea2b2d44b4ad
Reviewed-by: Olivier Soldano <olivier.soldano@savoirfairelinux.com>
  • Loading branch information
Guillaume Roguez authored and Olivier SOLDANO committed Jan 9, 2018
1 parent cec8785 commit f15925c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/peer_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,12 @@ PeerConnection::PeerConnectionImpl::eventLoop()
handle_stream_list(inputs_, [&](auto& stream){
if (!stream->read(buf))
return false;
endpoint_->write(buf, ec);
return true;
auto size = endpoint_->write(buf, ec);
if (!ec)
return true;
if (!size)
return false;
throw std::system_error(ec);
});
handle_stream_list(outputs_, [&](auto& stream){
endpoint_->read(buf, ec);
Expand Down

0 comments on commit f15925c

Please sign in to comment.