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

Side by Side Diff: net/tools/quic/quic_socket_utils.cc

Issue 1343093003: Landing Recent QUIC changes until 9/2/2015 17:00 UTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with TOT Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « net/tools/quic/quic_server_session.cc ('k') | net/tools/quic/test_tools/quic_test_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <netinet/in.h> 8 #include <netinet/in.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <sys/uio.h> 10 #include <sys/uio.h>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 iovec iov = {buffer, buf_len}; 109 iovec iov = {buffer, buf_len};
110 struct sockaddr_storage raw_address; 110 struct sockaddr_storage raw_address;
111 msghdr hdr; 111 msghdr hdr;
112 112
113 hdr.msg_name = &raw_address; 113 hdr.msg_name = &raw_address;
114 hdr.msg_namelen = sizeof(sockaddr_storage); 114 hdr.msg_namelen = sizeof(sockaddr_storage);
115 hdr.msg_iov = &iov; 115 hdr.msg_iov = &iov;
116 hdr.msg_iovlen = 1; 116 hdr.msg_iovlen = 1;
117 hdr.msg_flags = 0; 117 hdr.msg_flags = 0;
118 118
119 struct cmsghdr* cmsg = (struct cmsghdr*)cbuf; 119 struct cmsghdr* cmsg = reinterpret_cast<struct cmsghdr*>(cbuf);
120 cmsg->cmsg_len = arraysize(cbuf); 120 cmsg->cmsg_len = arraysize(cbuf);
121 hdr.msg_control = cmsg; 121 hdr.msg_control = cmsg;
122 hdr.msg_controllen = arraysize(cbuf); 122 hdr.msg_controllen = arraysize(cbuf);
123 123
124 int bytes_read = recvmsg(fd, &hdr, 0); 124 int bytes_read = recvmsg(fd, &hdr, 0);
125 125
126 // Return before setting dropped packets: if we get EAGAIN, it will 126 // Return before setting dropped packets: if we get EAGAIN, it will
127 // be 0. 127 // be 0.
128 if (bytes_read < 0 && errno != 0) { 128 if (bytes_read < 0 && errno != 0) {
129 if (errno != EAGAIN) { 129 if (errno != EAGAIN) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 int rc = sendmsg(fd, &hdr, 0); 214 int rc = sendmsg(fd, &hdr, 0);
215 if (rc >= 0) { 215 if (rc >= 0) {
216 return WriteResult(WRITE_STATUS_OK, rc); 216 return WriteResult(WRITE_STATUS_OK, rc);
217 } 217 }
218 return WriteResult((errno == EAGAIN || errno == EWOULDBLOCK) ? 218 return WriteResult((errno == EAGAIN || errno == EWOULDBLOCK) ?
219 WRITE_STATUS_BLOCKED : WRITE_STATUS_ERROR, errno); 219 WRITE_STATUS_BLOCKED : WRITE_STATUS_ERROR, errno);
220 } 220 }
221 221
222 } // namespace tools 222 } // namespace tools
223 } // namespace net 223 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server_session.cc ('k') | net/tools/quic/test_tools/quic_test_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698