From: David ‘Bombe’ Roden Date: Sun, 20 Nov 2016 01:35:41 +0000 (+0100) Subject: Remove debug output X-Git-Tag: 0.9.7^2~413 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=11b5cd71eb4ce8a88b96b3c18b1cb038215a7710;p=Sone.git Remove debug output --- diff --git a/src/main/kotlin/net/pterodactylus/sone/core/DefaultElementLoader.kt b/src/main/kotlin/net/pterodactylus/sone/core/DefaultElementLoader.kt index 9eae597..77cf9a8 100644 --- a/src/main/kotlin/net/pterodactylus/sone/core/DefaultElementLoader.kt +++ b/src/main/kotlin/net/pterodactylus/sone/core/DefaultElementLoader.kt @@ -22,32 +22,27 @@ class DefaultElementLoader(private val freenetInterface: FreenetInterface, ticke private val imageCache = CacheBuilder.newBuilder().build() private val callback = object : FreenetInterface.BackgroundFetchCallback { override fun cancelForMimeType(uri: FreenetURI, mimeType: String): Boolean { - println("Got MIME Type “$mimeType” for $uri.") return !mimeType.startsWith("image/") } override fun loaded(uri: FreenetURI, mimeType: String, data: ByteArray) { - println("Got ${data.size} Bytes with MIME Type $mimeType for $uri.") if (!mimeType.startsWith("image/")) { return } ByteArrayInputStream(data).use { ImageIO.read(it) }?.let { - println("Successfully parsed images from $uri.") imageCache.get(uri.toString().decode().normalize()) { LinkedElement(uri.toString()) } } removeLoadingLink(uri) } override fun failed(uri: FreenetURI) { - println("Failed to load $uri.") failureCache.put(uri.toString().decode().normalize(), true) removeLoadingLink(uri) } private fun removeLoadingLink(uri: FreenetURI) { - println("Not loading anymore: $uri.") synchronized(loadingLinks) { loadingLinks.invalidate(uri.toString().decode().normalize()) } @@ -56,23 +51,18 @@ class DefaultElementLoader(private val freenetInterface: FreenetInterface, ticke override fun loadElement(link: String): LinkedElement { val normalizedLink = link.decode().normalize() - println("Checking for $normalizedLink...") synchronized(loadingLinks) { imageCache.getIfPresent(normalizedLink)?.run { - println("In the Image Cache: $normalizedLink") return this } failureCache.getIfPresent(normalizedLink)?.run { - println("In the Failure Cache: $normalizedLink") return LinkedElement(link, failed = true) } if (loadingLinks.getIfPresent(normalizedLink) == null) { - println("Not loading: $normalizedLink") loadingLinks.put(normalizedLink, true) freenetInterface.startFetch(FreenetURI(link), callback) } } - println("Returning loading element: $normalizedLink") return LinkedElement(link, loading = true) }