/**
* Ends the download stream
*/
void CCNGet::endStream()
{
	stream = ccn_fetch_close(stream);
	ccn_destroy(&ccn);
	ccn_charbuf_destroy(&templ);
	ccn_charbuf_destroy(&name);
}
コード例 #2
0
ファイル: ccn_fetch.c プロジェクト: netharis/ccnxaueb
/**
 * Destroys a ccn_fetch object.
 * Only destroys the underlying ccn connection if it was automatically created.
 * Forces all underlying streams to close immediately.
 * @returns NULL in all cases.
 */
extern struct ccn_fetch *
ccn_fetch_destroy(struct ccn_fetch *f) {
	// destroys a ccn_fetch object
	// always returns NULL
	// only destroys the underlying ccn connection if it was
	// automatically created, otherwise does not alter it
	if (f != NULL) {
		struct ccn *h = f->h;
		if (h != NULL && f->localConnect) {
			ccn_disconnect(h);
			ccn_destroy(&f->h);
		}
		// take down all of the streams
		while (f->nStreams > 0) {
			struct ccn_fetch_stream *fs = f->streams[0];
			if (fs == NULL) break;
			ccn_fetch_close(fs);
		}
		free(f);
	}
	return NULL;
}