Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Unified Diff: net/socket/socket_libevent.cc

Issue 879723002: When receiving OOB data on a socket, return ERR_OOB_DATA. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/net_error_list.h ('k') | net/socket/tcp_socket_libevent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socket_libevent.cc
diff --git a/net/socket/socket_libevent.cc b/net/socket/socket_libevent.cc
index 5f16c929ab202fd4c61ba4ed5070cb523fb0353d..001b8fb6f3595fc9e05415ad2aedb10f4486a3bf 100644
--- a/net/socket/socket_libevent.cc
+++ b/net/socket/socket_libevent.cc
@@ -418,7 +418,20 @@ void SocketLibevent::ConnectCompleted() {
int SocketLibevent::DoRead(IOBuffer* buf, int buf_len) {
int rv = HANDLE_EINTR(read(socket_fd_, buf->data(), buf_len));
- return rv >= 0 ? rv : MapSystemError(errno);
+ if (rv >= 0) {
+ return rv;
+ } else if (errno != EAGAIN) {
+ return MapSystemError(errno);
+ }
+
+ // The socket may have OOB data waiting, and libevent does not distinguish
+ // between ready inline and out-of-band data when it activates the
+ // callback. See if there is OOB data available.
+ rv = HANDLE_EINTR(recv(socket_fd_, buf->data(), buf_len, MSG_OOB));
+ if (rv >= 0) {
+ return ERR_OOB_DATA;
+ }
+ return ERR_IO_PENDING;
}
void SocketLibevent::ReadCompleted() {
« no previous file with comments | « net/base/net_error_list.h ('k') | net/socket/tcp_socket_libevent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698