summaryrefslogtreecommitdiffstats
path: root/jingle/glue/channel_socket_adapter.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-27 13:25:40 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-27 13:25:40 +0000
commit87185ec69cf9f943674e179ebe92ff2a063e37ce (patch)
treed83f0dda670663283f8a71c71d34cc02b70aff90 /jingle/glue/channel_socket_adapter.cc
parentaeebebb6c151a7bd90254470aaabded7511fb752 (diff)
downloadchromium_src-87185ec69cf9f943674e179ebe92ff2a063e37ce.zip
chromium_src-87185ec69cf9f943674e179ebe92ff2a063e37ce.tar.gz
chromium_src-87185ec69cf9f943674e179ebe92ff2a063e37ce.tar.bz2
Drop packets when io pending is received for UDP sockets.
On Windows UDP sockets will return a WOULDBLOCK but a writeable notification will never happen in libjingle code. When we receive such error in the glue code we should report a success and drop the packets. BUG=None TEST=Connect to a windows box to itself, network will be alright. Review URL: http://codereview.chromium.org/7380003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94281 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle/glue/channel_socket_adapter.cc')
-rw-r--r--jingle/glue/channel_socket_adapter.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/jingle/glue/channel_socket_adapter.cc b/jingle/glue/channel_socket_adapter.cc
index e8e0c78..f0671b0 100644
--- a/jingle/glue/channel_socket_adapter.cc
+++ b/jingle/glue/channel_socket_adapter.cc
@@ -68,14 +68,18 @@ int TransportChannelSocketAdapter::Write(
int result;
if (channel_->writable()) {
result = channel_->SendPacket(buffer->data(), buffer_size);
- if (result < 0)
+ if (result < 0) {
result = net::MapSystemError(channel_->GetError());
+
+ // If the underlying socket returns IO pending where it shouldn't we
+ // pretend the packet is dropped and return as succeeded because no
+ // writeable callback will happen.
+ if (result == net::ERR_IO_PENDING)
+ result = net::OK;
+ }
} else {
// Channel is not writable yet.
result = net::ERR_IO_PENDING;
- }
-
- if (result == net::ERR_IO_PENDING) {
write_callback_ = callback;
write_buffer_ = buffer;
write_buffer_size_ = buffer_size;