While looking into chromium:1374310 I noticed that the function was
returning 0 in a particular case. 0 isn't a valid return value as per
this shortened snippet from connection.cc [1] specifically meant to
catch this:
int sent = port_->SendTo(...);
if (sent <= 0) {
RTC_DCHECK(sent < 0);
error_ = port_->GetError();
...
[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/p2p/base/connection.cc;l=1687
Also propagating the socket error value in case of failure.
Bug: chromium:1374310
Change-Id: Ie00f60388d53d4127c1d419ab0352e0574044485
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279282
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38408}