summaryrefslogtreecommitdiffstats
path: root/jingle
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-22 19:35:49 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-22 19:35:49 +0000
commit4d83fbc168b0d199040665536b15a87b5c40160a (patch)
tree98dd6c43fb610acedc0d85eb773bc0e361911c60 /jingle
parented1cba26e150bb891005707d9d0757ef032dbc78 (diff)
downloadchromium_src-4d83fbc168b0d199040665536b15a87b5c40160a.zip
chromium_src-4d83fbc168b0d199040665536b15a87b5c40160a.tar.gz
chromium_src-4d83fbc168b0d199040665536b15a87b5c40160a.tar.bz2
Use PseudoTcpAdapter in Chromoting
This will also avoid the problem with running cricket::PseudoTcpChannel in sandbox on Windows. BUG=None TEST=Unittests Review URL: http://codereview.chromium.org/6880126 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r--jingle/glue/channel_socket_adapter.cc25
-rw-r--r--jingle/glue/channel_socket_adapter_unittest.cc2
2 files changed, 18 insertions, 9 deletions
diff --git a/jingle/glue/channel_socket_adapter.cc b/jingle/glue/channel_socket_adapter.cc
index 1cdcf01..1141baf 100644
--- a/jingle/glue/channel_socket_adapter.cc
+++ b/jingle/glue/channel_socket_adapter.cc
@@ -64,16 +64,23 @@ int TransportChannelSocketAdapter::Write(
return closed_error_code_;
}
- int result = channel_->SendPacket(buffer->data(), buffer_size);
- if (result < 0) {
- result = net::MapSystemError(channel_->GetError());
- if (result == net::ERR_IO_PENDING) {
- write_pending_ = true;
- write_callback_ = callback;
- write_buffer_ = buffer;
- write_buffer_size_ = buffer_size;
- }
+ int result;
+ if (channel_->writable()) {
+ result = channel_->SendPacket(buffer->data(), buffer_size);
+ if (result < 0)
+ result = net::MapSystemError(channel_->GetError());
+ } else {
+ // Channel is not writable yet.
+ result = net::ERR_IO_PENDING;
}
+
+ if (result == net::ERR_IO_PENDING) {
+ write_pending_ = true;
+ write_callback_ = callback;
+ write_buffer_ = buffer;
+ write_buffer_size_ = buffer_size;
+ }
+
return result;
}
diff --git a/jingle/glue/channel_socket_adapter_unittest.cc b/jingle/glue/channel_socket_adapter_unittest.cc
index 60e60b6..fa4315d 100644
--- a/jingle/glue/channel_socket_adapter_unittest.cc
+++ b/jingle/glue/channel_socket_adapter_unittest.cc
@@ -31,6 +31,8 @@ class MockTransportChannel : public cricket::TransportChannel {
public:
MockTransportChannel()
: cricket::TransportChannel("", "") {
+ set_writable(true);
+ set_readable(true);
}
MOCK_METHOD2(SendPacket, int(const char *data, size_t len));