void downloader_instance_simple::handle_open(const boost::system::error_code& ec) { if (!ec) { ofstream_.open(file_, (std::ios_base::out | std::ios_base::binary | std::ios_base::trunc) ); if (!ofstream_) { if (owner()->state_notify_) owner()->state_notify_(http_downloader::stateError); return; } read_stream_.async_read_some( boost::asio::buffer(buffer_), boost::bind(&downloader_instance_simple::handle_read, shared_from_this(), _1, _2)); owner()->state_ = http_downloader_simple::stateDownload; if (owner()->state_notify_) owner()->state_notify_(http_downloader::stateStart); } else { if (owner()->state_notify_) owner()->state_notify_(http_downloader::stateError); } }
inline void DEBUG_TURNS_START(const std::string & debug_turns_path) { dg_output_turn_debug = debug_turns_path != ""; if (dg_output_turn_debug) { dg_debug_turns_file.open(debug_turns_path); dg_debug_turns_file << "{\"type\":\"FeatureCollection\", \"features\":[" << std::endl; } }
inline void DEBUG_GEOMETRY_START(const ContractorConfig &config) { time_t raw_time; struct tm *timeinfo; time(&raw_time); timeinfo = localtime(&raw_time); strftime(dg_time_buffer, 80, "%Y-%m-%d %H:%M %Z", timeinfo); dg_output_debug_geometry = config.debug_geometry_path != ""; if (dg_output_debug_geometry) { debug_geometry_file.open(config.debug_geometry_path, std::ios::binary); debug_geometry_file << "{\"type\":\"FeatureCollection\", \"features\":[" << std::endl; } }