
Hi Felipe, --- Felipe Magno de Almeida <felipe.m.almeida@gmail.com> wrote: <snip>
I think that one possible solution would be that error checks would be than by the asio, and redirect it to another function if an error is found. That way could be binded two functions. It even seems to be possible to create auxiliary classes that does this things on top of the current asio library. It would even make the code a lot clearer, comparing to both .NET and current asio usage.
This could be done by composing a new function object to be passed as the handler, e.g.: async_read(s, buffers, combine_handlers(handler1, handler2)); Boost.Lambda may also be of some use here. However I am not convinced that this approach would be widely applicable. There are many cases in networking where an error for an individual operation is not an error for the application. I also see the current "exactly-once" semantics of invoking handlers as important in aiding correct program design, so I'd be wary of using anything that changed that. Cheers, Chris