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

Side by Side Diff: src/platform-win32.cc

Issue 10416006: Handle EINTR in socket functions and continue incomplete sends. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/platform-posix.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 closesocket(socket_); 1842 closesocket(socket_);
1843 socket_ = INVALID_SOCKET; 1843 socket_ = INVALID_SOCKET;
1844 return status == SOCKET_ERROR; 1844 return status == SOCKET_ERROR;
1845 } 1845 }
1846 return true; 1846 return true;
1847 } 1847 }
1848 1848
1849 1849
1850 int Win32Socket::Send(const char* data, int len) const { 1850 int Win32Socket::Send(const char* data, int len) const {
1851 if (len <= 0) return 0; 1851 if (len <= 0) return 0;
1852 int status = send(socket_, data, len, 0); 1852 int written = 0;
1853 return (status == SOCKET_ERROR) ? 0 : status; 1853 while (written < len) {
1854 int status = send(socket_, data + written, len - written, 0);
1855 if (status == 0) {
1856 break;
1857 } else if (status > 0) {
1858 written += status;
1859 } else {
1860 return 0;
1861 }
1862 }
1863 return written;
1854 } 1864 }
1855 1865
1856 1866
1857 int Win32Socket::Receive(char* data, int len) const { 1867 int Win32Socket::Receive(char* data, int len) const {
1858 if (len <= 0) return 0; 1868 if (len <= 0) return 0;
1859 int status = recv(socket_, data, len, 0); 1869 int status = recv(socket_, data, len, 0);
1860 return (status == SOCKET_ERROR) ? 0 : status; 1870 return (status == SOCKET_ERROR) ? 0 : status;
1861 } 1871 }
1862 1872
1863 1873
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 2117
2108 2118
2109 void Sampler::Stop() { 2119 void Sampler::Stop() {
2110 ASSERT(IsActive()); 2120 ASSERT(IsActive());
2111 SamplerThread::RemoveActiveSampler(this); 2121 SamplerThread::RemoveActiveSampler(this);
2112 SetActive(false); 2122 SetActive(false);
2113 } 2123 }
2114 2124
2115 2125
2116 } } // namespace v8::internal 2126 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698