Commit Graph

864 Commits

Author SHA1 Message Date
Christopher Kohlhoff
e5c82d221a Try making the ip::multicast::enable_loopback socket option an unsigned char on AIX.
[SVN r39503]
2007-09-24 13:19:31 +00:00
Christopher Kohlhoff
cad9b88130 Strict compilers don't like it when you pass a function with C linkage
as an argument when the parameter type has C++ linkage. Try using the type
of the msghdr::msg_namelen field as an alternative way of deducing the
socklen_t-equivalent type.


[SVN r39443]
2007-09-21 12:34:19 +00:00
Christopher Kohlhoff
1837283e91 Eliminate use of types and structure members that may not be present when
build for non-XOPEN targets.


[SVN r39432]
2007-09-20 22:33:29 +00:00
Christopher Kohlhoff
7e67ec6336 Some compilers require namespace-scope declarations of use_service,
has_service and add_service.


[SVN r39431]
2007-09-20 22:30:54 +00:00
Christopher Kohlhoff
ae79df6318 Move handler queue management to a separate class.
[SVN r39430]
2007-09-20 22:26:55 +00:00
Christopher Kohlhoff
d61cf1e0b8 Larger storage size needed for Windows x64.
[SVN r39429]
2007-09-20 22:20:57 +00:00
Christopher Kohlhoff
50e479d4ab Fix unused argument warning.
[SVN r39364]
2007-09-18 13:13:40 +00:00
Christopher Kohlhoff
520f11ff1b AIX seems to have the socket address family as an unsigned char rather than unsigned short.
[SVN r39211]
2007-09-12 12:24:21 +00:00
Christopher Kohlhoff
3e05da91c1 Use enum-based error code constants.
[SVN r39189]
2007-09-11 11:17:56 +00:00
Christopher Kohlhoff
a79f4c70ea Fix problem where a thread can go idle even if there are handlers that are
ready to be dispatched.

Remove need to have a mutex per idle thread.

Remove need to have a mutex per idle thread.


[SVN r39098]
2007-09-01 06:41:15 +00:00
Christopher Kohlhoff
2a61b8a501 Add #include needed for IOV_MAX.
[SVN r39097]
2007-09-01 06:33:44 +00:00
Christopher Kohlhoff
817fe44ac4 Ensure that a strand is kept alive as long as there are wrapped handlers
for it.


[SVN r39096]
2007-09-01 06:28:40 +00:00
Christopher Kohlhoff
992d80498d Add AIX-specific compile time test for whether sockaddr_storage's family
field is called ss_family or __ss_family.


[SVN r39095]
2007-09-01 06:25:55 +00:00
Christopher Kohlhoff
71d9f010a8 Enable buffer() overload workaround for Sun C++.
[SVN r39094]
2007-09-01 06:20:19 +00:00
Christopher Kohlhoff
9df7f38577 Fix unused argument warnings.
[SVN r38791]
2007-08-20 14:32:05 +00:00
Christopher Kohlhoff
78d7795fba Increase number of buffers that may be sent or received in a single operation.
Clean up win_iocp_socket_service's close-on-destruction handling to ensure
non-blocking socket destructors.


[SVN r38788]
2007-08-20 14:17:15 +00:00
Christopher Kohlhoff
984fd932d6 Fix unused argument warning.
[SVN r38787]
2007-08-20 14:12:31 +00:00
Christopher Kohlhoff
69310edc3c Fix order of initialisation problem with error categories.
[SVN r38786]
2007-08-20 14:11:46 +00:00
Christopher Kohlhoff
989ff8a599 Add missing static keyword to the service_id_matches functions.
[SVN r38785]
2007-08-20 14:08:16 +00:00
Christopher Kohlhoff
25fa47276c Add a workaround for Windows Vista's handling of the boolean socket option
tcp::no_delay, where ::getsockopt will return the size of the option as one
byte, even though a four byte integer was passed in.


[SVN r38784]
2007-08-20 14:07:23 +00:00
Christopher Kohlhoff
4d914fcd64 Add a note to basic_socket<>::close() indicating that shutdown() should
be used for portable graceful closure.


[SVN r38783]
2007-08-20 13:53:27 +00:00
Christopher Kohlhoff
b98a841fa6 Improve documentation for completion condition objects.
[SVN r38323]
2007-07-31 11:39:30 +00:00
Christopher Kohlhoff
0a42306700 Always restart epoll_reactor operations if the callback handler indicates
that they should be restarted, even if there was an error associated with
the file descriptor, to ensure that operations don't get "lost".

Don't cleanup pending timer objects while the reactor lock is held, since
the destructors for the objects may try to make calls back into the
reactor.


[SVN r38322]
2007-07-31 11:36:10 +00:00
Christopher Kohlhoff
e12b0141a6 Eliminate spurious warning for MSVC8 when using /W4 and /Wp64.
[SVN r38321]
2007-07-31 11:35:00 +00:00
Christopher Kohlhoff
dac0aa7f77 Need to include socket_types.hpp for definition of _WIN32_WINNT.
[SVN r38320]
2007-07-31 11:34:12 +00:00
Christopher Kohlhoff
788d350ec5 Don't cleanup pending timer objects while the reactor lock is held, since
the destructors for the objects may try to make calls back into the
reactor.


[SVN r38319]
2007-07-31 11:33:29 +00:00
Christopher Kohlhoff
3f41710b85 Add support for the non-POSIX getaddrinfo errors EAI_NODATA and
EAI_ADDRFAMILY.


[SVN r38318]
2007-07-31 11:32:49 +00:00
Christopher Kohlhoff
3cb6db7cae Don't perform debug check with 0-sized buffers.
[SVN r38053]
2007-06-21 23:29:19 +00:00
Christopher Kohlhoff
86a79bede3 Add missing error message.
[SVN r37798]
2007-05-27 08:04:32 +00:00
Christopher Kohlhoff
65e054db78 Work around mysterious Borland C++ bug that prevents getsockopt and
setsockopt from working correctly.


[SVN r37734]
2007-05-21 13:05:06 +00:00
Christopher Kohlhoff
1742d2e664 Documentation fixes.
[SVN r37720]
2007-05-20 01:04:11 +00:00
Christopher Kohlhoff
cbba2f8ecd Documentation updates.
[SVN r37718]
2007-05-20 00:30:54 +00:00
Christopher Kohlhoff
463b06e4b0 To get portable behaviour for SO_REUSEADDR with UDP, the Mac OS X and BSD
platforms also need SO_REUSEPORT to be set.


[SVN r37717]
2007-05-20 00:28:55 +00:00
Christopher Kohlhoff
68b94f2dc0 Need to enable SO_NOSIGPIPE option on FreeBSD.
[SVN r37715]
2007-05-20 00:28:13 +00:00
Christopher Kohlhoff
899d252fb9 Allow everything to compile on platforms where IPV6_V6ONLY is not defined
(such as Linux distros with a 2.4 kernel), but make any use of ip::v6_only
fail at runtime.


[SVN r37681]
2007-05-13 08:18:09 +00:00
Christopher Kohlhoff
972c54ba27 Preserve the user-set blocking mode over an async connect.
[SVN r37673]
2007-05-12 10:48:24 +00:00
Christopher Kohlhoff
75dd9fdefe Need to define IPV6_UNICAST_HOPS when building with an old Platform SDK.
[SVN r37672]
2007-05-12 10:48:01 +00:00
Christopher Kohlhoff
41bf5929d3 Zero out address structure to prevent failures on some platforms.
[SVN r37671]
2007-05-12 10:47:15 +00:00
Christopher Kohlhoff
9ec1d04a0b Some older UNIX platforms return EPROTO from accept() to indicate that a
connection was lost before being fully established.


[SVN r37670]
2007-05-12 10:46:47 +00:00
Christopher Kohlhoff
cbe0de5634 Add documentation note specifying that pending handlers are still executed
after a strand is destroyed.


[SVN r37632]
2007-05-08 13:40:08 +00:00
Christopher Kohlhoff
05518d58e6 Ensure internal non-blocking flag is set if the user wants non-blocking.
[SVN r37631]
2007-05-08 13:39:04 +00:00
Christopher Kohlhoff
288b994d9b Add header file containing Boost.Asio version number.
[SVN r37628]
2007-05-08 12:20:38 +00:00
Christopher Kohlhoff
66424c1579 Clarify behaviour of io_service::run() in a thread pool.
[SVN r37606]
2007-05-06 22:36:18 +00:00
Christopher Kohlhoff
c64a2dbdaa Fix ip::multicast::enable_loopback option so that it works on Solaris.
[SVN r37605]
2007-05-06 22:35:35 +00:00
Christopher Kohlhoff
8437b8a23f Fix bug in timer heap management.
[SVN r37483]
2007-04-22 07:42:59 +00:00
Christopher Kohlhoff
18dcdcb3ab Enable buffer debugging for g++ when _GLIBCXX_DEBUG is defined.
[SVN r37482]
2007-04-22 07:41:54 +00:00
Christopher Kohlhoff
d926a9054f Don't copy a default-constructed vector iterator.
[SVN r37481]
2007-04-22 07:38:55 +00:00
Christopher Kohlhoff
905e8594fb Fix comments.
[SVN r37389]
2007-04-07 08:54:58 +00:00
Christopher Kohlhoff
4667159f1c Fix problem where the safe_cancellation_thread_id_ was not being calculated
correctly.


[SVN r37388]
2007-04-07 08:50:42 +00:00
Christopher Kohlhoff
2fc7b8e99c Fix libstdc++ debug error.
[SVN r37387]
2007-04-07 08:48:12 +00:00
Christopher Kohlhoff
bafa5a3c7a Some fixes for Solaris, AIX and HP-UX.
[SVN r37020]
2007-02-20 13:19:53 +00:00
Christopher Kohlhoff
f8af480754 Fix crash in comparison of service ids.
[SVN r37018]
2007-02-20 13:15:08 +00:00
Christopher Kohlhoff
adf40110f9 Solaris defines FD_ZERO to use an unqualified call to memset, so we need to
make the function visible using 'using namespace std'.


[SVN r36938]
2007-02-13 07:15:36 +00:00
Christopher Kohlhoff
0d4ccec23f Fix use of hash_value overloads to work on x64 with the Vista version of
the Platform SDK.


[SVN r36917]
2007-02-09 06:44:12 +00:00
Christopher Kohlhoff
6267a27180 Fix to correctly clear error after successful call of WSAAddresstoString or
WSAStringToAddress.


[SVN r36916]
2007-02-09 06:43:00 +00:00
Christopher Kohlhoff
bb236cb7b3 Add is_open() function to acceptor.
[SVN r36915]
2007-02-09 06:41:29 +00:00
Christopher Kohlhoff
3fb401181e Use IN6ADDR_ANY_INIT rather than IPPROTO_IPV6 to detect whether the Windows
Platform SDK supports IPv6, since the Vista Platform SDK has changed
IPPROTO_IPV6 to an enum.


[SVN r36904]
2007-02-06 22:34:02 +00:00
Christopher Kohlhoff
44b862a24a Workaround is needed for BDS2006.
[SVN r36903]
2007-02-06 22:23:48 +00:00
Christopher Kohlhoff
2520c84cd0 Update basic_socket_streambuf and basic_socket_iostream to (almost) match
the TR2 proposal.


[SVN r36753]
2007-01-19 01:09:33 +00:00
Christopher Kohlhoff
39f2ce8d45 Add ability to turn iostream output buffering off.
[SVN r36730]
2007-01-15 07:43:01 +00:00
Christopher Kohlhoff
2212dddb1f Automatically break large buffers into smaller chunks when using read(),
async_read(), write() or async_write().


[SVN r36724]
2007-01-13 23:17:41 +00:00
Christopher Kohlhoff
0c536811ff The misc_ecat error category now needs to be available for Win32 builds.
[SVN r36718]
2007-01-13 12:27:06 +00:00
Christopher Kohlhoff
7db5f2d133 Fix bug where the io_service could incorrectly run out of work (and so shut
down) when an overlapped I/O function fails immediately.


[SVN r36717]
2007-01-13 12:21:01 +00:00
Christopher Kohlhoff
4ee1510c76 Update socket interfaces to match TR2 proposal.
[SVN r36675]
2007-01-09 13:54:51 +00:00
Christopher Kohlhoff
282a9f2146 Update timer classes to match TR2 proposal.
[SVN r36663]
2007-01-08 03:01:13 +00:00
Christopher Kohlhoff
1a72ddb9a7 Update io_service interface to match TR2 proposal.
[SVN r36662]
2007-01-08 01:30:05 +00:00
Christopher Kohlhoff
06402569d5 Update the behaviour of the asio::streambuf overloads of {async_}read and
{async_}read_until to match the TR2 proposal.


[SVN r36636]
2007-01-07 08:26:18 +00:00
Christopher Kohlhoff
5607a01c21 Add ip::unicast::hops and ip::v6_only socket options.
[SVN r36595]
2007-01-06 09:10:54 +00:00
Christopher Kohlhoff
6c632c2967 Fix examples to match current socket option interface.
[SVN r36594]
2007-01-06 09:08:13 +00:00
Christopher Kohlhoff
66dd4c3778 Rename const_buffer_container_1 to const_buffers_1 and
mutable_buffer_container_1 to mutable_buffers_1.


[SVN r36585]
2007-01-04 10:45:09 +00:00
Christopher Kohlhoff
a7209ee0be Rename io_service::interrupt() to io_service::stop().
[SVN r36583]
2007-01-04 09:22:02 +00:00
Christopher Kohlhoff
2ba4146527 Update socket option classes to match interface in TR2 proposal.
[SVN r36582]
2007-01-04 08:21:33 +00:00
Christopher Kohlhoff
2b4748aaaa Update copyright strings to include 2007.
[SVN r36581]
2007-01-04 05:53:07 +00:00
Christopher Kohlhoff
e4d9ea696a Add io_service::id to identify service classes.
[SVN r36580]
2007-01-04 03:43:37 +00:00
Christopher Kohlhoff
af1cb70843 Fix for Borland C++.
[SVN r36579]
2007-01-04 03:39:38 +00:00
Christopher Kohlhoff
fb8dd74390 Documentation cleanup.
[SVN r36578]
2007-01-04 03:38:18 +00:00
Christopher Kohlhoff
390ffd9f7e Exclude error_base from documentation.
[SVN r36577]
2007-01-04 03:38:02 +00:00
Christopher Kohlhoff
00690b50ed Add documentation.
[SVN r36502]
2006-12-24 08:35:08 +00:00
Christopher Kohlhoff
7a2eac3878 Map ERROR_PORT_UNREACHABLE to WSAECONNREFUSED.
[SVN r36474]
2006-12-21 04:07:27 +00:00
Christopher Kohlhoff
ae1be56a05 Move erase from hash_map to prevent multiple delete.
[SVN r36473]
2006-12-21 04:06:41 +00:00
Christopher Kohlhoff
5cded59aef Replace win_iocp_io_service::register_socket() with register_handle() to
allow it to be used with other Windows kernel objects.


[SVN r36311]
2006-12-09 22:31:44 +00:00
Christopher Kohlhoff
e3f0c76fce Use static placeholders for VC7.x.
[SVN r36169]
2006-11-23 21:59:10 +00:00
Christopher Kohlhoff
99d1078a15 Add equality/inequality operators for protocol classes.
[SVN r36106]
2006-11-20 12:59:49 +00:00
Christopher Kohlhoff
dca74fd492 Include <ostream> instead of <iostream>.
[SVN r36096]
2006-11-19 21:33:43 +00:00
Christopher Kohlhoff
8d8077a267 Add missing inline keyword, needed to fix multiple definition errors.
[SVN r36095]
2006-11-19 21:33:04 +00:00
Christopher Kohlhoff
b0e159fc55 Add a workaround for an apparent Windows bug where the delivery of
asynchronous I/O completions is delayed if the thread used to start the
operation is CPU bound.


[SVN r36069]
2006-11-17 11:40:48 +00:00
Christopher Kohlhoff
8b56b8cf6d Remove the error::success constant since with the new error_code stuff
there is no unique value for success.


[SVN r36068]
2006-11-17 11:28:18 +00:00
Christopher Kohlhoff
0b9d2dc400 Add ability to specify the level of concurrency desired, which is currently
used by Win32's I/O completion ports.


[SVN r36057]
2006-11-16 11:50:57 +00:00
Christopher Kohlhoff
3cc30008b4 Need to clear error after successful call of WSAAddressToString or
WSAStringToAddress.


[SVN r36056]
2006-11-16 11:49:11 +00:00
Christopher Kohlhoff
e504cf5c6c Remove unnecessary invoke hook since the default one provides the correct
behaviour, and including it here for the invoke_current_handler class breaks
MSVC 7.1 when generating browse information.


[SVN r36055]
2006-11-16 11:47:42 +00:00
Christopher Kohlhoff
837470ac11 Don't use named temporary since it confuses g++ 3.3.
[SVN r36039]
2006-11-14 10:50:18 +00:00
Christopher Kohlhoff
2b7016726f Inclusion of boost/cerrno.hpp is needed, so revert previous change.
[SVN r36038]
2006-11-14 10:49:09 +00:00
Christopher Kohlhoff
94979ba49f Remove documentation that is no longer correct.
[SVN r36037]
2006-11-14 10:41:33 +00:00
Christopher Kohlhoff
fb3eaba113 Change to use function-based placeholders for gcc to avoid some duplicate
symbol linker problems.


[SVN r36036]
2006-11-14 10:40:55 +00:00
Christopher Kohlhoff
e128068a1f Remove unnecessary include.
[SVN r36035]
2006-11-14 10:40:05 +00:00
Christopher Kohlhoff
851d074dd6 The openssl_locking_func() callback can be invoked through
OpenSSL_add_ssl_algorithms(), which causes instance() to be called
recursively before the static shared_ptr was initialized.


[SVN r35942]
2006-11-09 03:04:05 +00:00
Christopher Kohlhoff
852668d1da Change error handling to match TR2 proposal.
[SVN r35911]
2006-11-08 05:32:17 +00:00
Christopher Kohlhoff
da2ef49a00 Add max_size() function to basic_streambuf.
Make basic_io_object constructor protected.

Make a 0-length send or receive on a stream socket into a no-op.

Add cancel() function for cancelling asynchronous socket operations.
The Win32 implementation only works if all operations for the socket
have been issued from the same thread, otherwise it fails with
asio::error::not_supported.

Add workaround for an apparent Windows bug where using getpeername on
a socket accepted using AcceptEx will sometimes return an endpoint
that is all zeroes.

Make a strand last as long as it has any handlers to dispatch. Make
strand a nested class of io_service.

Add io_service() function to io_service::work to return a reference to
the io_service object on which the work is being performed. Renamed
io_service::service::owner() to io_service::service::io_service().

Unset linger object when socket objects are destroyed.

Rename asio_handler_dispatch to asio_handler_invoke.

Rename basic_socketbuf to basic_socket_streambuf.

Update ip::address_v4 and ip::address_v6 classes to match TR2
proposal.

Add run_one(), poll() and poll_one() functions to the io_service.

Remove need to #define FD_SETSIZE on Win32.

Add detection of incorrect inclusion of WinSock.h.

Fix some SSL bugs. Add ability to customise the SSL password callback
function.

Set the reuse_address option by default on acceptors.

The macros FIONREAD and FIONBIO are not integer constants on all
platforms, and so cannot be used as template arguments. Make the
corresponding I/O control commands into proper classes, not templates.

Fixes to better support *BSD platforms.

Add support for buffer debugging, if the standard library supports
iterator debugging (as MSVC8's standard lib does).

Ensure the IOCP queue is drained correctly at shutdown.

Move basic_resolver and resolver service into the ip namespace.

Fix some issues found by the inspect tool.


[SVN r35833]
2006-11-04 07:14:10 +00:00
Christopher Kohlhoff
8e4fa8f544 Maintain separate timer queues for each time traits type.
[SVN r34740]
2006-07-26 11:23:25 +00:00
Christopher Kohlhoff
f7e92ba296 Fix compiler warnings with MSVC8.
[SVN r34739]
2006-07-26 11:19:21 +00:00
Christopher Kohlhoff
1b337d8054 Fix two problems in the SSL implementation:
- A read operation should check the read buffer first to see if there's any
  data present and use that first, before issuing a new read from the
  socket.

- The read buffer was a member of the openssl_operation class, and a new
  openssl_operation object is created for each read or write initiated by
  the application. This meant that any surplus data from a previous read is
  lost. Changed the buffer to be a member of the stream object.


[SVN r34738]
2006-07-26 11:14:12 +00:00
Christopher Kohlhoff
418caa0ef9 Remove tab characters.
[SVN r34725]
2006-07-25 11:01:15 +00:00
Christopher Kohlhoff
72dfeb78e5 Add overloads of read_until and async_read_until that take a string. Fix
bug in regex-based overload of async_read_until.


[SVN r34488]
2006-07-09 07:08:03 +00:00
Christopher Kohlhoff
5e2d09cdf2 Remove redundant code after end of endless for loop.
[SVN r34487]
2006-07-09 06:59:50 +00:00
Christopher Kohlhoff
66ce772f7a Remove accidentally duplicated code. Fix error in conditional expression.
[SVN r34486]
2006-07-09 06:58:54 +00:00
Christopher Kohlhoff
b8e5e53b5f Remove extraneous comma from end of enumerator list.
[SVN r34485]
2006-07-09 06:57:33 +00:00
Christopher Kohlhoff
7027bf39d5 Change strand implementation so that dispatch will execute a handler
immediately if called from within the strand.

Add hook function for customising handler dispatch.

Need to use reinterpret_cast when testing for enable_connection_aborted
socket option, to allow non-int socket options to compile correctly.


[SVN r34464]
2006-07-05 05:48:10 +00:00
Christopher Kohlhoff
27d17b40fb Use correct form for strerror_r on NetBSD.
[SVN r34462]
2006-07-05 05:27:48 +00:00
Christopher Kohlhoff
6171e026e7 Add support for compiling on Mac OS X 10.3.
[SVN r34461]
2006-07-05 05:26:35 +00:00
Christopher Kohlhoff
a0962bfdb5 Automatically define WIN32 for MSVC, since some old Platform SDKs don't
automatically define it, but Winsock2.h requires it.


[SVN r34460]
2006-07-05 05:22:22 +00:00
Christopher Kohlhoff
73ce705d9b Documentation fixes. Clean up basic_streambuf-related functions.
[SVN r34332]
2006-06-18 08:01:10 +00:00
Christopher Kohlhoff
75a90a7723 Fix bug in reactor_op_queue::dispatch_all_operations().
[SVN r34331]
2006-06-18 07:59:26 +00:00
Christopher Kohlhoff
9f8d3f88c6 Ensure synchronous SSL functions call the supplied Error_Handler object.
[SVN r34330]
2006-06-18 07:58:02 +00:00
Christopher Kohlhoff
da0cf5f68a Initial asio checkin.
[SVN r34306]
2006-06-14 22:26:36 +00:00