From 65f1a5fed676f4df36c3fe8912e16a48bd4d7950 Mon Sep 17 00:00:00 2001
From: jrandom <jrandom>
Date: Tue, 20 Apr 2004 13:30:09 +0000
Subject: [PATCH] write out the public dest every time we connect, /including/
 the first time.  (thanks duck)

---
 .../java/src/net/i2p/heartbeat/I2PAdapter.java      | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/apps/heartbeat/java/src/net/i2p/heartbeat/I2PAdapter.java b/apps/heartbeat/java/src/net/i2p/heartbeat/I2PAdapter.java
index 46eb8c6a26..a6daaee368 100644
--- a/apps/heartbeat/java/src/net/i2p/heartbeat/I2PAdapter.java
+++ b/apps/heartbeat/java/src/net/i2p/heartbeat/I2PAdapter.java
@@ -467,6 +467,19 @@ class I2PAdapter {
                 if (_log.shouldLog(Log.INFO)) {
                     _log.info("New destination created: [" + us.toBase64() + "]");
                 }
+                fos.close();
+                
+                try {
+                    fos = new FileOutputStream(_publicDestFile);
+                    fos.write(us.toBase64().getBytes());
+                    fos.flush();
+                } catch (IOException fioe) {
+                    _log.error("Error writing out the plain destination to [" + _publicDestFile + "]", fioe);
+                } finally {
+                    if (fos != null) try { fos.close(); } catch (IOException fioe) {}
+                    fos = null;
+                }
+                
             } catch (IOException ioe) {
                 if (_log.shouldLog(Log.ERROR)) {
                     _log.error("Error writing out the destination keys being created", ioe);
-- 
GitLab