Beispiel #1
0
		void NeighborDatabase::NeighborEntry::releaseTransfer(const dtn::data::BundleID &id)
		{
			ibrcommon::MutexLock l(_transit_lock);
			_transit_bundles.erase(id);

			IBRCOMMON_LOGGER_DEBUG_TAG("NeighborDatabase", 20) << "release transfer of " << id.toString() << " (" << _transit_bundles.size() << " bundles in transit)" << IBRCOMMON_LOGGER_ENDL;
		}
Beispiel #2
0
		void NativeSession::delivered(const dtn::data::BundleID &id) const throw (BundleNotFoundException)
		{
			try {
				// announce this bundle as delivered
				const dtn::data::MetaBundle meta = dtn::core::BundleCore::getInstance().getStorage().info(id);
				_registration.delivered(meta);

				IBRCOMMON_LOGGER_DEBUG_TAG(NativeSession::TAG, 20) << "Bundle " << id.toString() << " marked as delivered" << IBRCOMMON_LOGGER_ENDL;
			} catch (const ibrcommon::Exception&) {
				throw BundleNotFoundException();
			}
		}
Beispiel #3
0
		bool NeighborDatabase::NeighborEntry::has(const dtn::data::BundleID &id, const bool require_bloomfilter) const
		{
			if (_filter_state == FILTER_AVAILABLE)
			{
				if (_filter.contains(id.toString()))
					return true;
			}
			else if (require_bloomfilter)
			{
				throw BloomfilterNotAvailableException(eid);
			}

			return _summary.has(id);
		}
Beispiel #4
0
		void NativeSession::load(RegisterIndex ri, const dtn::data::BundleID &id) throw (BundleNotFoundException)
		{
			// load the bundle
			try {
				_bundle[ri] = dtn::core::BundleCore::getInstance().getStorage().get(id);

				// process the bundle block (security, compression, ...)
				dtn::core::BundleCore::processBlocks(_bundle[ri]);

				IBRCOMMON_LOGGER_DEBUG_TAG(NativeSession::TAG, 20) << "Bundle " << id.toString() << " loaded" << IBRCOMMON_LOGGER_ENDL;
			} catch (const ibrcommon::Exception &ex) {
				IBRCOMMON_LOGGER_DEBUG_TAG(NativeSession::TAG, 15) << "Failed to load bundle " << id.toString() << ", Exception: " << ex.what() << IBRCOMMON_LOGGER_ENDL;
				throw BundleNotFoundException();
			}
		}
Beispiel #5
0
		void NeighborDatabase::NeighborEntry::acquireTransfer(const dtn::data::BundleID &id) throw (NoMoreTransfersAvailable, AlreadyInTransitException)
		{
			ibrcommon::MutexLock l(_transit_lock);

			// check if enough resources available to transfer the bundle
			if (_transit_bundles.size() >= dtn::core::BundleCore::max_bundles_in_transit) throw NoMoreTransfersAvailable();

			// check if the bundle is already in transit
			if (_transit_bundles.find(id) != _transit_bundles.end()) throw AlreadyInTransitException();

			// insert the bundle into the transit list
			_transit_bundles.insert(id);

			IBRCOMMON_LOGGER_DEBUG_TAG("NeighborDatabase", 20) << "acquire transfer of " << id.toString() << " (" << _transit_bundles.size() << " bundles in transit)" << IBRCOMMON_LOGGER_ENDL;
		}
Beispiel #6
0
		void NativeSession::next(RegisterIndex ri) throw (BundleNotFoundException)
		{
			try {
				const dtn::data::BundleID id = _bundle_queue.getnpop();

				IBRCOMMON_LOGGER_DEBUG_TAG(NativeSession::TAG, 20) << "Next bundle in queue is " << id.toString() << IBRCOMMON_LOGGER_ENDL;

				load(ri, id);
			} catch (const ibrcommon::QueueUnblockedException &ex) {
				IBRCOMMON_LOGGER_DEBUG_TAG(NativeSession::TAG, 15) << "No next bundle available" << IBRCOMMON_LOGGER_ENDL;
				throw BundleNotFoundException();
			}
		}