OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/tools/quic/quic_socket_utils.h" | 5 #include "net/tools/quic/quic_socket_utils.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 // Apple's "in6.h" header file says: | |
9 // * RFC 3542 define[s] the following socket options in a manner incompatible | |
10 // * with RFC 2292: | |
11 // * IPV6_PKTINFO | |
12 // and in order to get IPV6_PKTINFO defined at all, | |
13 // you must pick a mode, as follows: | |
14 #define __APPLE_USE_RFC_3542 | |
15 #include <netinet/in.h> | 8 #include <netinet/in.h> |
16 #undef __APPLE_USE_RFC_3542 | |
17 #include <sys/socket.h> | 9 #include <sys/socket.h> |
18 #include <sys/uio.h> | 10 #include <sys/uio.h> |
19 #include <string> | 11 #include <string> |
20 | 12 |
21 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
22 #include "base/logging.h" | 14 #include "base/logging.h" |
23 #include "net/quic/quic_protocol.h" | 15 #include "net/quic/quic_protocol.h" |
24 | 16 |
25 #ifndef SO_RXQ_OVFL | 17 #ifndef SO_RXQ_OVFL |
26 #define SO_RXQ_OVFL 40 | 18 #define SO_RXQ_OVFL 40 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 int rc = sendmsg(fd, &hdr, 0); | 237 int rc = sendmsg(fd, &hdr, 0); |
246 if (rc >= 0) { | 238 if (rc >= 0) { |
247 return WriteResult(WRITE_STATUS_OK, rc); | 239 return WriteResult(WRITE_STATUS_OK, rc); |
248 } | 240 } |
249 return WriteResult((errno == EAGAIN || errno == EWOULDBLOCK) ? | 241 return WriteResult((errno == EAGAIN || errno == EWOULDBLOCK) ? |
250 WRITE_STATUS_BLOCKED : WRITE_STATUS_ERROR, errno); | 242 WRITE_STATUS_BLOCKED : WRITE_STATUS_ERROR, errno); |
251 } | 243 } |
252 | 244 |
253 } // namespace tools | 245 } // namespace tools |
254 } // namespace net | 246 } // namespace net |
OLD | NEW |