Reviewers: Mads Ager,

Message:
The code for each of the four platforms is almost identical. The
differences are:

initialization is required in Windows

close is closesocket on Windows

option SO_REUSEADDR is set for listener sockets on Mac OS

type is int except on Windows where is is SOCKET (#define of int in
header file)

As the code relies on platform header files it needs to be in the
platform files. Adding an #include of a .cc file implementing the
commons in class Scoket instead of derived class <Platform>Scoket might
be an option. Then again the implementation of Thread is also almost
identical on Linux, Mac OS and FreeBSD.

I think we should keep separate implementations for now until this is
well tested and the "real" differences have materialized.

Description:
Add socket support to platform code.

The new Socket class is an encapsulation of the standard BSD socket API.
As it depends on platform specific include files and have some slight
platform variations it is part of the platform code.

On Mac OS only the option SO_REUSEADDR is set to true for server
sockets. Running the test required it as the bound listener socket would
sometimes end up in TIME_WAIT. On Windows and Linux this has never been
observed (given the client end of the socket is closed before the server
end).

The code has been tested on Windows, Linux and Mac OS. The FreeBSD
version is a copy of the Linux version but has not been compiled nor
tested.

Missing Xcode project updates.

Please review this at http://codereview.chromium.org/27085

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     SConstruct
   M     src/platform-freebsd.cc
   M     src/platform-linux.cc
   M     src/platform-macos.cc
   M     src/platform-win32.cc
   M     src/platform.h
   M     test/cctest/SConscript
   A     test/cctest/test-sockets.cc
   M     tools/visual_studio/d8.vcproj
   M     tools/visual_studio/v8_cctest.vcproj
   M     tools/visual_studio/v8_mksnapshot.vcproj
   M     tools/visual_studio/v8_process_sample.vcproj
   M     tools/visual_studio/v8_shell_sample.vcproj



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to