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

Unified Diff: net/base/listen_socket.cc

Issue 100225: POSIX: Add a macro for handling EINTR. (Closed)
Patch Set: ... Created 11 years, 8 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/file_stream_posix.cc ('k') | net/base/listen_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/listen_socket.cc
diff --git a/net/base/listen_socket.cc b/net/base/listen_socket.cc
index a172e46f6e6c4041fc0a96e1bad91fd926c43151..7d3b0e892c8f4b4f538c1a1fd42176dca768aaf0 100644
--- a/net/base/listen_socket.cc
+++ b/net/base/listen_socket.cc
@@ -16,6 +16,7 @@
#include "third_party/libevent/event.h"
#endif
+#include "base/eintr_wrappers.h"
#include "net/base/net_util.h"
#include "net/base/listen_socket.h"
@@ -93,7 +94,8 @@ void ListenSocket::Listen() {
SOCKET ListenSocket::Accept(SOCKET s) {
sockaddr_in from;
socklen_t from_len = sizeof(from);
- SOCKET conn = accept(s, reinterpret_cast<sockaddr*>(&from), &from_len);
+ SOCKET conn =
+ HANDLE_EINTR(accept(s, reinterpret_cast<sockaddr*>(&from), &from_len));
if (conn != INVALID_SOCKET) {
net::SetNonBlocking(conn);
}
@@ -119,7 +121,7 @@ void ListenSocket::Read() {
char buf[kReadBufSize + 1]; // +1 for null termination
int len;
do {
- len = recv(socket_, buf, kReadBufSize, 0);
+ len = HANDLE_EINTR(recv(socket_, buf, kReadBufSize, 0));
if (len == SOCKET_ERROR) {
#if defined(OS_WIN)
int err = WSAGetLastError();
@@ -188,7 +190,7 @@ void ListenSocket::WatchSocket(WaitState state) {
}
void ListenSocket::SendInternal(const char* bytes, int len) {
- int sent = send(socket_, bytes, len, 0);
+ int sent = HANDLE_EINTR(send(socket_, bytes, len, 0));
if (sent == SOCKET_ERROR) {
#if defined(OS_WIN)
int err = WSAGetLastError();
« no previous file with comments | « net/base/file_stream_posix.cc ('k') | net/base/listen_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698