summaryrefslogtreecommitdiffstats
path: root/net/udp/udp_socket_libevent.cc
Commit message (Collapse)AuthorAgeFilesLines
* Bind before sandbox lockdown on Windows.vitalybuka@chromium.org2014-03-061-0/+4
| | | | | | | | | | Linux is unaffected. All changed code already is inside sandbox. BUG=348692 Review URL: https://codereview.chromium.org/185293014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255311 0039d316-1c4b-4281-b951-d872f2087c98
* Fix error checking and error reporting in GetIPv4AddressFromIndex.wtc@chromium.org2014-03-041-3/+3
| | | | | | | | | | R=vitalybuka@chromium.org BUG=none TEST=none Review URL: https://codereview.chromium.org/185403013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254713 0039d316-1c4b-4281-b951-d872f2087c98
* Map posix error codes in bind better, and fix one windows mapping.jar@chromium.org2013-12-211-1/+8
| | | | | | | | | r=wtc BUG=330233 Review URL: https://codereview.chromium.org/101193008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242224 0039d316-1c4b-4281-b951-d872f2087c98
* Get proper value for OS error to histogramjar@chromium.org2013-12-131-3/+5
| | | | | | | | BUG=326545 Review URL: https://codereview.chromium.org/115363003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240806 0039d316-1c4b-4281-b951-d872f2087c98
* Handle error in a socket->connect() attempt inside quic_stream_factoryjar@chromium.org2013-12-131-0/+4
| | | | | | | | | R=rch BUG=327057 Review URL: https://codereview.chromium.org/105083006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240586 0039d316-1c4b-4281-b951-d872f2087c98
* Pass the least amount of info to CreateSocket and RandomBind.wtc@chromium.org2013-12-121-12/+17
| | | | | | | | | | | | | | CreateSocket just needs the address family for the new socket. RandomBind just needs the (local) IP address; it will select a port at random. R=jar@chromium.org BUG=none TEST=none Review URL: https://codereview.chromium.org/110163006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240315 0039d316-1c4b-4281-b951-d872f2087c98
* Add support of IP_MULTICAST_IF in UDP sockets.vitalybuka@chromium.org2013-12-051-6/+83
| | | | | | | | BUG=319068 Review URL: https://codereview.chromium.org/99923004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238939 0039d316-1c4b-4281-b951-d872f2087c98
* Don't HANDLE_EINTR(close). Either IGNORE_EINTR(close) or just close.mark@chromium.org2013-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is incorrect to wrap close in HANDLE_EINTR on Linux. Correctness is generally undefined on Mac, but as of r223369, it is incorrect in Chrome on Mac. To avoid new offenders, a PRESUBMIT check ensures that HANDLE_EINTR is not used with close, and that IGNORE_EINTR is only used with close. Unnecessary #includes of eintr_wrapper.h are also removed. base/posix/einter_wrapper.h, PRESUBMIT.py, and ppapi/tests/test_broker.cc contain non-mechanical changes. Variable naming within the latter is updated per r178174. Missing #includes for <errno.h> in content/zygote/zygote_main_linux.cc and tools/android/common/daemon.cc were manually added. Mechanical changes were generated by running: sed -E -i '' \ -e 's/((=|if|return|CHECK|EXPECT|ASSERT).*)HANDLE(_EINTR\(.*close)/\1IGNORE\3/' \ -e 's/(ignore_result|void ?)\(HANDLE_EINTR\((.*close\(.*)\)\)/\2/' \ -e 's/(\(void\) ?)?HANDLE_EINTR\((.*close\(.*)\)/\2/' \ $(git grep -El 'HANDLE_EINTR.*close') sed -E -i '' -e '/#include.*eintr_wrapper\.h"/d' \ $(grep -EL '(HANDLE|IGNORE)_EINTR' \ $(git grep -El '#include.*eintr_wrapper\.h"')) BUG=269623 R=agl@chromium.org, jln@chromium.org TBR=OWNERS Review URL: https://codereview.chromium.org/100253002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238390 0039d316-1c4b-4281-b951-d872f2087c98
* Implement support for p2p socket UDP packages to set the Differntiated ↵hubbe@chromium.org2013-10-221-0/+20
| | | | | | | | | | Services Code Point for each package. Will be used by webrtc to hopefully improve performance. (See bug for how we will test this.) BUG=277022 Review URL: https://codereview.chromium.org/22381012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229975 0039d316-1c4b-4281-b951-d872f2087c98
* PlatformSocketFactory integrated with libevent sockets.vitalybuka@chromium.org2013-08-291-1/+2
| | | | | | | | BUG=277654 Review URL: https://chromiumcodereview.appspot.com/23474004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220170 0039d316-1c4b-4281-b951-d872f2087c98
* Add local address of UDP sockets used to check IPv6 support to NetLogszym@chromium.org2013-07-231-0/+2
| | | | | | | | | | | Adds UDP_LOCAL_ADDRESS NetLog event, and logs the UDP sockets used to determine IPv6 support. BUG=259792 Review URL: https://chromiumcodereview.appspot.com/19492013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213193 0039d316-1c4b-4281-b951-d872f2087c98
* Use a direct include of the message_loop header in net/, part 3.avi@chromium.org2013-07-181-1/+1
| | | | | | | | | | BUG=260807 TEST=none TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/19486003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212191 0039d316-1c4b-4281-b951-d872f2087c98
* Remove net::ServerSocket::setAllowReuseAddress and fix server socket on Windows.ikarienator@chromium.org2013-07-041-14/+26
| | | | | | | | | | | | | | | | | | | SO_REUSEADDR is useful for server sockets to bind to a recently unbound port. When a socket is closed, the end point changes its state to TIME_WAIT and wait for 2 MSL (maximum segment lifetime) to ensure the remote peer acknowledges its closure. For server sockets, it is usually safe to bind to a TIME_WAIT end point immediately, which is a widely adopted behavior. On Linux SO_REUSEADDR does not enable the TCP socket to bind to an end point that is already bound by another socket. To do that one must set SO_REUSEPORT instead. However, on Windows, SO_REUSEADDR works as if both SO_REUSEDPORT and SO_REUSEADDR are set. Furthermore, A bound end point can be hijacked by another process by setting SO_REUSEADDR. Therefore a Windows-only option SO_EXCLUSIVEADDRUSE was introduced in Windows NT 4.0 SP4. If the socket that is bound to the end point has SO_EXCLUSIVEADDRUSE enabled, it is not possible for another socket to forcibly bind to the end point until the end point is unbound. Also, unlike on *nix, on Windows a TCP server socket can always bind to an end point in TIME_WAIT state without setting SO_REUSEADDR, therefore we cannot emulate a similar behavior of disabling SO_REUSEADDR here. This is considered a security issue and MSDN (http://goo.gl/M6fjQ) recommends all server applications to use SO_EXCLUSIVEADDRUSE. BUG=173533 TBR=brettw@chromium.org Review URL: https://chromiumcodereview.appspot.com/15179003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210147 0039d316-1c4b-4281-b951-d872f2087c98
* Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*"rsleevi@chromium.org2013-06-011-3/+4
| | | | | | | | | | | Linux fixes BUG=110610 TBR=darin Review URL: https://chromiumcodereview.appspot.com/15829004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203535 0039d316-1c4b-4281-b951-d872f2087c98
* net: Use base::MessageLoop.xhwang@chromium.org2013-05-231-4/+4
| | | | | | | | | BUG=236029 R=agl@chromium.org Review URL: https://chromiumcodereview.appspot.com/14021017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201882 0039d316-1c4b-4281-b951-d872f2087c98
* Adding ERR_SOCKET_IS_CONNECTED.ikarienator@chromium.org2013-05-011-3/+3
| | | | | | | | BUG=235066 Review URL: https://chromiumcodereview.appspot.com/14666002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197713 0039d316-1c4b-4281-b951-d872f2087c98
* Introduce Multicast Socket APIikarienator@chromium.org2013-04-301-5/+132
| | | | | | | | | | | | | | | | | | | | | | | | | Allow Chrome Apps developer to receive multicast socket packets by exposing join/leave group ability to UDP socket. Introducing: 1. chrome.socket.joinGroup / chrome.socket.leaveGroup / chrome.socket.getJoinedGroups to manipulate multicast group membership. 2. Socket permission 'udp-multicast-membership'. 3. chrome.socket.setMulticastTimeToLive / chrome.socket.setMulticastLoopbackMode to control the multicast packet sending for UDP sender. To expose the ability of manipulating multicast group membership and controlling multicast packet sending, new methods are added into network stack (net::UDPSocket class): 1. JoinGroup/LeaveGroup 2. SetMulticastTimeToLive/SetMulticastLoopbackMode To demo the ability, a demo app is created: https://github.com/GoogleChrome/chrome-app-samples/pull/92 TEST=Open the demo app at /chrome-app-samples/multicast in two machines of the same network. Open them and chat, they can talk to each other. NOTRY=true BUG=140681 Review URL: https://chromiumcodereview.appspot.com/12684008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197192 0039d316-1c4b-4281-b951-d872f2087c98
* Make UDPSocket{Libevent,Win}::Connect close socket if it failsttuttle@chromium.org2013-02-221-0/+2
| | | | | | | | | | Right now, we leave the socket in an indeterminate state -- to the rest of the methods, it looks like Connect succeeded, but to the caller, it doesn't. Review URL: https://chromiumcodereview.appspot.com/12259034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184197 0039d316-1c4b-4281-b951-d872f2087c98
* [net] Make IPEndPoint::GetFamily() return AddressFamily and add ↵szym@chromium.org2012-12-131-1/+1
| | | | | | | | | | | | GetSockAddrFamily() to be used when creating sockets. BUG=126002 TEST=browse anywhere Review URL: https://chromiumcodereview.appspot.com/11528012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172768 0039d316-1c4b-4281-b951-d872f2087c98
* Move eintr_wrapper.h from base to base/posixbrettw@chromium.org2012-11-141-1/+1
| | | | | | Review URL: https://codereview.chromium.org/11366229 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167739 0039d316-1c4b-4281-b951-d872f2087c98
* SO_REUSEPORT socket option is set up when Broadcast feature is requested. ↵ygorshenin@chromium.org2012-09-181-6/+10
| | | | | | | | | | | | Previously it's not caused any bugs because when broadcasting feature is needed, address reuse feature is set up too. BUG=none TEST=net_unittests:UDPSocketTest.* Review URL: https://chromiumcodereview.appspot.com/10917235 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157373 0039d316-1c4b-4281-b951-d872f2087c98
* Clean-up inline members of nested classes (net/)hans@chromium.org2012-08-091-0/+10
| | | | | | | | | | | | | | | | Due to a bug, the Clang-plugin style checker failed to warn about inline constructors, destructors, non-empty virtual methods, etc. for nested classes. The plugin has been fixed, and this patch is part of a clean-up of all the code that now causes the plugin to issue errors. BUG=139346 Review URL: https://chromiumcodereview.appspot.com/10854063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150917 0039d316-1c4b-4281-b951-d872f2087c98
* Added broadcasting feature to UDP server sockets.ygorshenin@chromium.org2012-07-161-0/+41
| | | | | | | | | BUG=136797 TEST=net_unittests:UDPSocketTest.Broadcast Review URL: https://chromiumcodereview.appspot.com/10739002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146790 0039d316-1c4b-4281-b951-d872f2087c98
* NetLogEventParameter to Callback refactoring 4.mmenke@chromium.org2012-06-141-18/+11
| | | | | | | | | | | Get rid of all uses of NetLogEventParameters in net/udp and net/dns. R=eroman@chromium.org BUG=126243 Review URL: https://chromiumcodereview.appspot.com/10546133 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142076 0039d316-1c4b-4281-b951-d872f2087c98
* Reimplements net::AddressList without struct addrinfo.szym@chromium.org2012-05-071-35/+23
| | | | | | | | | | | | | | | | net::AddressList extends std::vector<std::IPEndPoint> by canonical name. (Canonical name is planned to be removed as well.) Removes dependency on sys_addrinfo.h throughout the codebase. Introduces net::SockaddrStorage for convenience. BUG=125696 TEST=green waterfall Review URL: http://codereview.chromium.org/10309002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135731 0039d316-1c4b-4281-b951-d872f2087c98
* Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind().ajwong@chromium.org2011-12-091-60/+16
| | | | | | | | | | | This changes Socket::Read(), Socket::Write, and StreamSocket::Connect() to use CompletionCallback and fixes all users. BUG=none TEST=existing. Review URL: http://codereview.chromium.org/8824006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113825 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 113699 - base::Bind: Convert Socket::Write.jhawkins@chromium.org2011-12-091-51/+7
| | | | | | | | | | | | | BUG=none TEST=none R=csilv Review URL: http://codereview.chromium.org/8831001 TBR=jhawkins@chromium.org Review URL: http://codereview.chromium.org/8889036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113719 0039d316-1c4b-4281-b951-d872f2087c98
* base::Bind: Convert Socket::Write.jhawkins@chromium.org2011-12-081-7/+51
| | | | | | | | | | BUG=none TEST=none R=csilv Review URL: http://codereview.chromium.org/8831001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113699 0039d316-1c4b-4281-b951-d872f2087c98
* base::Bind: Convert Socket::Read.jhawkins@chromium.org2011-12-071-8/+50
| | | | | | | | | | BUG=none TEST=none R=csilv Review URL: http://codereview.chromium.org/8801005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113326 0039d316-1c4b-4281-b951-d872f2087c98
* Add NetLog support to UDP sockets.mmenke@chromium.org2011-10-181-31/+89
| | | | | | | | | | BUG=99508 TEST=UDPSocketTest.Connect Review URL: http://codereview.chromium.org/8200011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106109 0039d316-1c4b-4281-b951-d872f2087c98
* Set send buffer size for P2P UDP sockets.sergeyu@chromium.org2011-10-181-0/+18
| | | | | | | | | | | | On windows the default send buffer is too small. Set it explicitly to prevent packets from being lost when sending. BUG=None TEST=None Review URL: http://codereview.chromium.org/8304008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105995 0039d316-1c4b-4281-b951-d872f2087c98
* Begin CompletionCallback switchover.willchan@chromium.org2011-10-011-7/+7
| | | | | | | | | | | | | Rename CompletionCallback to OldCompletionCallback in preparation for introducing a new CompletionCallback based on base::Callback. Also renames other CompletionCallback types like CancelableCompletionCallback and TestCompletionCallback and CompletionCallbackImpl. All using sed with s/CompletionCallback/OldCompletionCallback/g. BUG=98719 TEST=none Review URL: http://codereview.chromium.org/8070013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103650 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for random UDP source port selection to avoid birthday attacks ↵agayev@chromium.org2011-06-291-22/+60
| | | | | | | | | | | in DNS implementation. BUG=60149 TEST=net_unittests Review URL: http://codereview.chromium.org/7202011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90925 0039d316-1c4b-4281-b951-d872f2087c98
* net doesn't depend on libevent directly now.wtc@chromium.org2011-06-221-5/+0
| | | | | | | | | | | | | | | | Remove unnecessary forward declarations of struct event and inclusions of the event.h header. Use MessageLoopForIO::FileDescriptorWatcher and MessageLoopForIO::Watcher typedefs. R=mark@chromium.org,rvargas@chromium.org BUG=none TEST=no build errors Review URL: http://codereview.chromium.org/7232002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89995 0039d316-1c4b-4281-b951-d872f2087c98
* Fix UDPSocket::GetLocalAddress() to return correct port number.sergeyu@chromium.org2011-04-051-1/+1
| | | | | | | | | | | | | bind() may assign port to a socket when it is called with port=0, but UDPSocket::Bind() saves |address| in |local_address_|, so GetLocalAddress() would not return correct port number. BUG=None TEST=Unittests Review URL: http://codereview.chromium.org/6691068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80530 0039d316-1c4b-4281-b951-d872f2087c98
* Removed the static on all stats macros and changed the static declarationrtenneti@chromium.org2011-03-221-3/+3
| | | | | | | | | | | | | of StatsCounter, StatsCounterTimer and StatsRate variables to auto. This change would fix possibel race condition during static's initialization in multi-threaded environments. BUG=76980 TEST=unit tests in net, browser and plugins R=jar@chromium.org Review URL: http://codereview.chromium.org/6719011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79065 0039d316-1c4b-4281-b951-d872f2087c98
* Fix DCHECK in UDPSocket::RecvFrom().sergeyu@chromium.org2011-03-161-24/+37
| | | | | | | | | | | | Before this change the DCHECK in RecvFrom() may fail there is data in the read buffer, and recvfrom() reads data instead of blocking. BUG=None TEST=None Review URL: http://codereview.chromium.org/6693005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78307 0039d316-1c4b-4281-b951-d872f2087c98
* Move MapWinsockError() and MapPosixError() to net_errors.h.sergeyu@chromium.org2011-03-151-60/+11
| | | | | | | | | | | | Added new net::MapSystemError() that is now used in place of MapWinsockError() and MapPosixError() BUG=None TEST=compiles Review URL: http://codereview.chromium.org/6694032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78279 0039d316-1c4b-4281-b951-d872f2087c98
* Don't fire callbacks on Close(). Caller should take care of this already,mbelshe@chromium.org2011-03-141-5/+10
| | | | | | | | | | | | and this matches the way our tcp_client_socket works today. BUG=none TEST=none Review URL: http://codereview.chromium.org/6682023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78058 0039d316-1c4b-4281-b951-d872f2087c98
* UDP sockets implementation for windows.sergeyu@chromium.org2011-03-121-14/+28
| | | | | | | | | BUG=None TEST=Unittests Review URL: http://codereview.chromium.org/6658027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77895 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 77870 - UDP sockets implementation for windows.sergeyu@chromium.org2011-03-111-28/+14
| | | | | | | | | | | | BUG=None TEST=Unittests Review URL: http://codereview.chromium.org/6658027 TBR=sergeyu@chromium.org Review URL: http://codereview.chromium.org/6681014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77872 0039d316-1c4b-4281-b951-d872f2087c98
* UDP sockets implementation for windows.sergeyu@chromium.org2011-03-111-14/+28
| | | | | | | | | BUG=None TEST=Unittests Review URL: http://codereview.chromium.org/6658027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77870 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 77855 - UDP sockets implementation for windows.sergeyu@chromium.org2011-03-111-28/+14
| | | | | | | | | | | | BUG=None TEST=Unittests Review URL: http://codereview.chromium.org/6658027 TBR=sergeyu@chromium.org Review URL: http://codereview.chromium.org/6685015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77866 0039d316-1c4b-4281-b951-d872f2087c98
* UDP sockets implementation for windows.sergeyu@chromium.org2011-03-111-14/+28
| | | | | | | | | BUG=None TEST=Unittests Review URL: http://codereview.chromium.org/6658027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77855 0039d316-1c4b-4281-b951-d872f2087c98
* Use IPEndPoint for UDP sockets.sergeyu@chromium.org2011-03-091-46/+64
| | | | | | | | | BUG=None TEST=Unittest Review URL: http://codereview.chromium.org/6650018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77498 0039d316-1c4b-4281-b951-d872f2087c98
* Add an initial API and implementation for UDP Sockets.mbelshe@chromium.org2011-03-021-0/+366
BUG=none TEST=none Review URL: http://codereview.chromium.org/6597039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76644 0039d316-1c4b-4281-b951-d872f2087c98