Example #1
0
	void URLFetcherImpl::OnError(HttpRequestJob* job, const asio::error_code& err)
	{
		status_.set_status(URLRequestStatus::FAILED);
		status_.set_error(err.value());
		if (delegate_)
			delegate_->OnURLFetchComplete(this);
	}
Example #2
0
void Connection::onConnectCompleted(const asio::error_code& err)
{
	UInt32 result = 1; 

	if ( !err )
	{
		result = 0;
	}

	EventRawConnected* e = new EventRawConnected;

	e->idx = GetUniqueId();
	e->result = result;
	e->socketIndex = GetSessionId();
	e->key = 0;

	m_net->Notify( EventPtr( e ) );

	if ( !err )
	{
		requestRecv();
	}
	else
	{
		// 에러 날 경우 연결 종료도 통보함
		onError( err );
	}

	MU2LogSystem( 0, "Connection::Error> [Code: %d]", err.value());
}
  static void do_complete(io_service_impl* owner, operation* base,
      asio::error_code ec, std::size_t bytes_transferred)
  {
    // Take ownership of the operation object.
    win_iocp_handle_read_op* o(static_cast<win_iocp_handle_read_op*>(base));
    ptr p = { boost::addressof(o->handler_), o, o };

#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
    if (owner)
    {
      // Check whether buffers are still valid.
      buffer_sequence_adapter<asio::mutable_buffer,
          MutableBufferSequence>::validate(o->buffers_);
    }
#endif // defined(ASIO_ENABLE_BUFFER_DEBUGGING)

    // Map non-portable errors to their portable counterparts.
    if (ec.value() == ERROR_HANDLE_EOF)
      ec = asio::error::eof;

    // Make a copy of the handler so that the memory can be deallocated before
    // the upcall is made. Even if we're not about to make an upcall, a
    // sub-object of the handler may be the true owner of the memory associated
    // with the handler. Consequently, a local copy of the handler is required
    // to ensure that any owning sub-object remains valid until after we have
    // deallocated the memory here.
    detail::binder2<Handler, asio::error_code, std::size_t>
      handler(o->handler_, ec, bytes_transferred);
    p.h = boost::addressof(handler.handler_);
    p.reset();

    // Make the upcall if required.
    if (owner)
    {
      asio::detail::fenced_block b;
      asio_handler_invoke_helpers::invoke(handler, handler.handler_);
    }
  }