From toad at freenetproject.org Wed Jan 2 13:40:03 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Wed, 2 Jan 2008 13:40:03 +0000 (UTC) Subject: [freenet-cvs] r16844 - trunk/website/pages/en Message-ID: <20080102134003.2C3D747987F@freenetproject.org> Author: toad Date: 2008-01-02 13:40:02 +0000 (Wed, 02 Jan 2008) New Revision: 16844 Modified: trunk/website/pages/en/download.php Log: Point to /wizard/. Note that most people don't get this far as the installer opens a window to the page anyway. Explain a little. Modified: trunk/website/pages/en/download.php =================================================================== --- trunk/website/pages/en/download.php 2007-12-31 06:33:20 UTC (rev 16843) +++ trunk/website/pages/en/download.php 2008-01-02 13:40:02 UTC (rev 16844) @@ -102,9 +102,11 @@

Afer you start Freenet, wait a few seconds for it to start up (on a slow computer, you may need to wait about 30 seconds), and visit

+
http://127.0.0.1:8888/wizard/
+

in your web browser to access Freenet's user +interface. Freenet will ask you a few questions and then go to the node homepage,

http://127.0.0.1:8888/
-

in your web browser to access Freenet's user -interface.

+

from which you can access freesites, add friends etc.

Offline installation

Some people might encounter difficulties connecting to our server because of censorship. We do have an offline version of the installer available : Freenet 0.7 offline installer. You shouldn't use it unless you have to (it's bigger to download and might not be as up to date as the online one). From toad at freenetproject.org Wed Jan 2 13:52:07 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Wed, 2 Jan 2008 13:52:07 +0000 (UTC) Subject: [freenet-cvs] r16845 - trunk/website/pages/en Message-ID: <20080102135207.5F17B47BC09@freenetproject.org> Author: toad Date: 2008-01-02 13:52:07 +0000 (Wed, 02 Jan 2008) New Revision: 16845 Modified: trunk/website/pages/en/download.php Log: Improve download page explanations about insecure mode (not "promiscuous mode"), and the wizard. Modified: trunk/website/pages/en/download.php =================================================================== --- trunk/website/pages/en/download.php 2008-01-02 13:40:02 UTC (rev 16844) +++ trunk/website/pages/en/download.php 2008-01-02 13:52:07 UTC (rev 16845) @@ -106,15 +106,23 @@

in your web browser to access Freenet's user interface. Freenet will ask you a few questions and then go to the node homepage,

http://127.0.0.1:8888/
-

from which you can access freesites, add friends etc.

+

from which you can access freesites, add friends etc. Hopefully the installer +will open the page for you, so you won't be reading this.

Offline installation

Some people might encounter difficulties connecting to our server because of censorship. We do have an offline version of the installer available : Freenet 0.7 offline installer. You shouldn't use it unless you have to (it's bigger to download and might not be as up to date as the online one).

So it's running, what do I do?

-

You need to get connected. If you know anyone running Freenet, ask them -for their reference, and give them yours. If you visit

+

You need to get connected. The wizard will ask you whether to enable +insecure mode. If you do, your Freenet node should automatically announce +itself and start working within a few minutes. If not, Freenet will not +work until you add some friends on the Friends page.

+ +

If you know anyone running Freenet, even if you have enabled insecure +mode, you can improve your security and help to build the network by +connecting to their node. Ask them for their reference, and give them yours. +If you visit

http://127.0.0.1:8888/friends/

in your browser, you can see your reference at the bottom and you can add other people's references, either by cutting and pasting the reference @@ -122,7 +130,7 @@ reference.

Note: You need to add their reference and they need to add yours before your nodes can communicate.

-

If you don't know anyone running Freenet, enable promiscuous mode +

If you don't know anyone running Freenet, enable insecure mode (also known as opennet; the first time wizard will ask you), and wait a few minutes for the node to announce itself, and Freenet will start working by itself.

From toad at freenetproject.org Wed Jan 2 16:49:02 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Wed, 2 Jan 2008 16:49:02 +0000 (UTC) Subject: [freenet-cvs] r16846 - trunk/freenet/src/freenet/support Message-ID: <20080102164902.E956047BBE9@freenetproject.org> Author: toad Date: 2008-01-02 16:49:01 +0000 (Wed, 02 Jan 2008) New Revision: 16846 Modified: trunk/freenet/src/freenet/support/FileLoggerHook.java Log: Fix java.lang.IllegalArgumentException: Original doesn't exist! Modified: trunk/freenet/src/freenet/support/FileLoggerHook.java =================================================================== --- trunk/freenet/src/freenet/support/FileLoggerHook.java 2008-01-02 13:52:07 UTC (rev 16845) +++ trunk/freenet/src/freenet/support/FileLoggerHook.java 2008-01-02 16:49:01 UTC (rev 16846) @@ -298,8 +298,8 @@ System.err.println( "Closing alt on change caught " + e); } - if(previousFile != null) { - FileUtil.renameTo(latestFile, previousFile); + if(previousFile != null && previousFile.exists()) { + FileUtil.renameTo(latestFile, previousFile); latestFile.delete(); } else { latestFile.delete(); From toad at freenetproject.org Wed Jan 2 16:49:21 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Wed, 2 Jan 2008 16:49:21 +0000 (UTC) Subject: [freenet-cvs] r16847 - trunk/freenet/src/freenet/support Message-ID: <20080102164921.2229747BBE9@freenetproject.org> Author: toad Date: 2008-01-02 16:49:20 +0000 (Wed, 02 Jan 2008) New Revision: 16847 Modified: trunk/freenet/src/freenet/support/FileLoggerHook.java Log: indent: tidy up slightly Modified: trunk/freenet/src/freenet/support/FileLoggerHook.java =================================================================== --- trunk/freenet/src/freenet/support/FileLoggerHook.java 2008-01-02 16:49:01 UTC (rev 16846) +++ trunk/freenet/src/freenet/support/FileLoggerHook.java 2008-01-02 16:49:20 UTC (rev 16847) @@ -298,12 +298,9 @@ System.err.println( "Closing alt on change caught " + e); } - if(previousFile != null && previousFile.exists()) { + if(previousFile != null && previousFile.exists()) FileUtil.renameTo(latestFile, previousFile); - latestFile.delete(); - } else { - latestFile.delete(); - } + latestFile.delete(); altLogStream = openNewLogFile(latestFile, false); } //System.err.println("Rotated log files: "+filename); From svn-build at freenetproject.org Wed Jan 2 16:50:44 2008 From: svn-build at freenetproject.org (svn-build at freenetproject.org) Date: Wed, 2 Jan 2008 16:50:44 +0000 (UTC) Subject: [freenet-cvs] Verification of r16847 on emu Message-ID: <20080102165044.31E5C47BC01@freenetproject.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 toad has declared that 16847 is an 'indent only' commit: That's FALSE. Files orig/FileLoggerHook$WriterThread.class and new/FileLoggerHook$WriterThread.class differ orig/FileLoggerHook$1.class : ec2113c9326737fecf85a3fde2029b6320496215 : ec2113c9326737fecf85a3fde2029b6320496215 orig/FileLoggerHook.class : eefd01f8fc2283859e8abd8217d8a96eae2381d2 : eefd01f8fc2283859e8abd8217d8a96eae2381d2 orig/FileLoggerHook$CloserThread.class : 0ea1a612efe4f3448e8b1d7385e33f2155298d34 : 0ea1a612efe4f3448e8b1d7385e33f2155298d34 orig/FileLoggerHook$IntervalParseException.class : 5275ef6554ff1a86082cff5123c2cd2866737e41 : 5275ef6554ff1a86082cff5123c2cd2866737e41 orig/FileLoggerHook$OldLogFile.class : 7cae6bc6c59831a86fd27596f411be688516a486 : 7cae6bc6c59831a86fd27596f411be688516a486 orig/FileLoggerHook$WriterThread.class : dd82d2a08c1a0234400bccd04eaefbbfb0eaaa3e : 448c28f732b0a6804af921d7a4a0d3f05cc0b580 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iQIVAwUBR3vA5FiZGG6DH7hRAQI+kRAAlgCG4Do0IvbZ5M1cLnYNayasFzJI216+ l61PnMAQAMAnkXbfjRjjtWq2UduAYbSYlTQMJV3K4oTPVsLGg2lmS5aZIDAYq/FV hEQfWhlxi06YznM0spBWhKnBubvzFl9fmmsB6LF0Jr6qUExgvlfTE3rItbifnHyR lWgcP51k63rvvY26s4PKFrOaJMXP6fZGNDvCMMSetf/llCk8pfH0vsgaJu6fMdeZ cNmwcvrREer3uJLmvLkUjpVuY9GiUZaXP2px26aKxU0fgMkzqn5Pqgjxdbra+Zhk Nww5WZdtvHvV0edPLnsc+kLkqyk2lP+7Onv6AeMDtk02uHcpOHuoUp0UEjx1UruX BWABsIHDnBYk5YmtFo7gt4za05wC73uS1Dngf13q5xg6x+f7yirNXGOO3U4oKled HjTKS/ufpS8+dbSNTbBTSpB2b6iZ4jyQLgwA37+vlDp/upi8cKL5gl0Ww4AT5TVO c7D/2fI9bdpxa8X7x0GdTjQPvF94xglpqN9Gxwscwm7tURP6oL1ativU+R2DkS1F PwkDuB1n4eNK7uDI09JHg1h+/gbkzwYUjCf4owpSoRlNqKeHRgJPL3c6lDz2WrtP rKrk4Nd6L+o7BiTaThBt50zeOw/l1p0w7Awji43FhiJex8ho+/kBZdtvU4Y/l/gJ szVwUtuTZ9M= =TAgM -----END PGP SIGNATURE----- From toad at freenetproject.org Wed Jan 2 18:55:09 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Wed, 2 Jan 2008 18:55:09 +0000 (UTC) Subject: [freenet-cvs] r16848 - trunk/freenet/src/freenet/store Message-ID: <20080102185509.460C747BC04@freenetproject.org> Author: toad Date: 2008-01-02 18:55:08 +0000 (Wed, 02 Jan 2008) New Revision: 16848 Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java Log: Logging to try to catch cause of #1967. Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java =================================================================== --- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-02 16:49:20 UTC (rev 16847) +++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-02 18:55:08 UTC (rev 16848) @@ -1119,6 +1119,10 @@ } catch (CryptFormatException e) { addFreeBlock(l, true, "invalid key: "+e); failures++; + } catch (DatabaseException e) { + // t.abort() below may also throw. + System.err.println("Error while reconstructing: "+e); + e.printStackTrace(); } finally { if(t != null) t.abort(); } From toad at freenetproject.org Thu Jan 3 14:11:35 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 14:11:35 +0000 (UTC) Subject: [freenet-cvs] r16849 - trunk/freenet/src/freenet/clients/http/staticfiles Message-ID: <20080103141135.C61A0479971@freenetproject.org> Author: toad Date: 2008-01-03 14:11:35 +0000 (Thu, 03 Jan 2008) New Revision: 16849 Modified: trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat Log: Update to edition 44. Modified: trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat =================================================================== --- trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 2008-01-02 18:55:08 UTC (rev 16848) +++ trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 2008-01-03 14:11:35 UTC (rev 16849) @@ -23,7 +23,7 @@ BookmarkCategory0.Content.Bookmark0.Name=Another Index BookmarkCategory0.Content.Bookmark0.Description=A large categorised index, many sites have no description BookmarkCategory0.Content.Bookmark0.hasAnActivelink=false -BookmarkCategory0.Content.Bookmark0.URI=USK at zQyF2O1o8B4y40w7Twz8y2I9haW3d2DTlxjTHPu7zc8,h2mhQNNE9aQvF~2yKAmKV1uorr7141-QOroBf5hrlbw,AQACAAE/AnotherIndex/42/ +BookmarkCategory0.Content.Bookmark0.URI=USK at zQyF2O1o8B4y40w7Twz8y2I9haW3d2DTlxjTHPu7zc8,h2mhQNNE9aQvF~2yKAmKV1uorr7141-QOroBf5hrlbw,AQACAAE/AnotherIndex/44/ BookmarkCategory1.Name=Freenet devel's flogs BookmarkCategory1.Content.BookmarkCategory=0 BookmarkCategory1.Content.Bookmark=3 From toad at freenetproject.org Thu Jan 3 14:23:11 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 14:23:11 +0000 (UTC) Subject: [freenet-cvs] r16850 - trunk/apps/new_installer/res/unix/bin Message-ID: <20080103142311.E04E547B34F@freenetproject.org> Author: toad Date: 2008-01-03 14:23:11 +0000 (Thu, 03 Jan 2008) New Revision: 16850 Modified: trunk/apps/new_installer/res/unix/bin/detect_port_availability.sh Log: Disable tmci by default. Nobody uses it. Modified: trunk/apps/new_installer/res/unix/bin/detect_port_availability.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/detect_port_availability.sh 2008-01-03 14:11:35 UTC (rev 16849) +++ trunk/apps/new_installer/res/unix/bin/detect_port_availability.sh 2008-01-03 14:23:11 UTC (rev 16850) @@ -32,13 +32,3 @@ echo "Can not bind fcp to 9481: force it to $FCP_PORT instead." fi echo -e "fcp.enabled=true\nfcp.port=$FCP_PORT" >> freenet.ini - -# Try to auto-detect the first available port for console -CONSOLE_PORT=2323 -java -jar bin/bindtest.jar $CONSOLE_PORT 2>&1 >/dev/null -if test $? -ne 0 -then - CONSOLE_PORT=2324 - echo "Can not bind console to 2323: force it to $CONSOLE_PORT instead." -fi -echo -e "console.enabled=true\nconsole.port=$CONSOLE_PORT" >> freenet.ini From toad at freenetproject.org Thu Jan 3 14:24:43 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 14:24:43 +0000 (UTC) Subject: [freenet-cvs] r16851 - trunk/freenet/src/freenet/clients/http/staticfiles Message-ID: <20080103142443.B181447A014@freenetproject.org> Author: toad Date: 2008-01-03 14:24:43 +0000 (Thu, 03 Jan 2008) New Revision: 16851 Modified: trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat Log: update bombe edition number Modified: trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat =================================================================== --- trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 2008-01-03 14:23:11 UTC (rev 16850) +++ trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 2008-01-03 14:24:43 UTC (rev 16851) @@ -30,7 +30,7 @@ BookmarkCategory1.Content.Bookmark2.Name=Bombe BookmarkCategory1.Content.Bookmark2.Description=Bombe's blog BookmarkCategory1.Content.Bookmark2.hasAnActivelink=true -BookmarkCategory1.Content.Bookmark2.URI=USK at e3myoFyp5avg6WYN16ImHri6J7Nj8980Fm~aQe4EX1U,QvbWT0ImE0TwLODTl7EoJx2NBnwDxTbLTE6zkB-eGPs,AQACAAE/bombe/22/ +BookmarkCategory1.Content.Bookmark2.URI=USK at e3myoFyp5avg6WYN16ImHri6J7Nj8980Fm~aQe4EX1U,QvbWT0ImE0TwLODTl7EoJx2NBnwDxTbLTE6zkB-eGPs,AQACAAE/bombe/23/ BookmarkCategory1.Content.Bookmark1.Name=Nextgen$ BookmarkCategory1.Content.Bookmark1.Description=NextGen$' blog BookmarkCategory1.Content.Bookmark1.hasAnActivelink=true From toad at freenetproject.org Thu Jan 3 14:25:06 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 14:25:06 +0000 (UTC) Subject: [freenet-cvs] r16852 - trunk/freenet/src/freenet/clients/http/staticfiles Message-ID: <20080103142506.67F2D47B357@freenetproject.org> Author: toad Date: 2008-01-03 14:25:05 +0000 (Thu, 03 Jan 2008) New Revision: 16852 Modified: trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat Log: update AnotherIndex to 45 Modified: trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat =================================================================== --- trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 2008-01-03 14:24:43 UTC (rev 16851) +++ trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 2008-01-03 14:25:05 UTC (rev 16852) @@ -23,7 +23,7 @@ BookmarkCategory0.Content.Bookmark0.Name=Another Index BookmarkCategory0.Content.Bookmark0.Description=A large categorised index, many sites have no description BookmarkCategory0.Content.Bookmark0.hasAnActivelink=false -BookmarkCategory0.Content.Bookmark0.URI=USK at zQyF2O1o8B4y40w7Twz8y2I9haW3d2DTlxjTHPu7zc8,h2mhQNNE9aQvF~2yKAmKV1uorr7141-QOroBf5hrlbw,AQACAAE/AnotherIndex/44/ +BookmarkCategory0.Content.Bookmark0.URI=USK at zQyF2O1o8B4y40w7Twz8y2I9haW3d2DTlxjTHPu7zc8,h2mhQNNE9aQvF~2yKAmKV1uorr7141-QOroBf5hrlbw,AQACAAE/AnotherIndex/45/ BookmarkCategory1.Name=Freenet devel's flogs BookmarkCategory1.Content.BookmarkCategory=0 BookmarkCategory1.Content.Bookmark=3 From toad at freenetproject.org Thu Jan 3 14:25:29 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 14:25:29 +0000 (UTC) Subject: [freenet-cvs] r16853 - trunk/freenet/src/freenet/clients/http/staticfiles Message-ID: <20080103142529.276D147B74E@freenetproject.org> Author: toad Date: 2008-01-03 14:25:28 +0000 (Thu, 03 Jan 2008) New Revision: 16853 Modified: trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat Log: update Index des Sites Francais to edition 37 Modified: trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat =================================================================== --- trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 2008-01-03 14:25:05 UTC (rev 16852) +++ trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 2008-01-03 14:25:28 UTC (rev 16853) @@ -19,7 +19,7 @@ BookmarkCategory0.Content.Bookmark1.Name=Index des sites Fran?ais BookmarkCategory0.Content.Bookmark1.Description=A small French index with descriptions BookmarkCategory0.Content.Bookmark1.hasAnActivelink=true -BookmarkCategory0.Content.Bookmark1.URI=USK at RJnh1EnvOSPwOWVRS2nyhC4eIQkKoNE5hcTv7~yY-sM,pOloLxnKWM~AL24iDMHOAvTvCqMlB-p2BO9zK96TOZA,AQACAAE/index_fr/36/ +BookmarkCategory0.Content.Bookmark1.URI=USK at RJnh1EnvOSPwOWVRS2nyhC4eIQkKoNE5hcTv7~yY-sM,pOloLxnKWM~AL24iDMHOAvTvCqMlB-p2BO9zK96TOZA,AQACAAE/index_fr/37/ BookmarkCategory0.Content.Bookmark0.Name=Another Index BookmarkCategory0.Content.Bookmark0.Description=A large categorised index, many sites have no description BookmarkCategory0.Content.Bookmark0.hasAnActivelink=false From toad at freenetproject.org Thu Jan 3 14:25:46 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 14:25:46 +0000 (UTC) Subject: [freenet-cvs] r16854 - trunk/freenet/src/freenet/clients/http/staticfiles Message-ID: <20080103142546.A277047B74E@freenetproject.org> Author: toad Date: 2008-01-03 14:25:46 +0000 (Thu, 03 Jan 2008) New Revision: 16854 Modified: trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat Log: update TUFI to edition 9 Modified: trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat =================================================================== --- trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 2008-01-03 14:25:28 UTC (rev 16853) +++ trunk/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 2008-01-03 14:25:46 UTC (rev 16854) @@ -7,7 +7,7 @@ BookmarkCategory0.Content.Bookmark4.Name=The Ultimate FreeNet Index BookmarkCategory0.Content.Bookmark4.Description=A new one; page index BookmarkCategory0.Content.Bookmark4.hasAnActivelink=false -BookmarkCategory0.Content.Bookmark4.URI=USK at 0I8gctpUE32CM0iQhXaYpCMvtPPGfT4pjXm01oid5Zc,3dAcn4fX2LyxO6uCnWFTx-2HKZ89uruurcKwLSCxbZ4,AQACAAE/Ultimate-Freenet-Index/7/ +BookmarkCategory0.Content.Bookmark4.URI=USK at 0I8gctpUE32CM0iQhXaYpCMvtPPGfT4pjXm01oid5Zc,3dAcn4fX2LyxO6uCnWFTx-2HKZ89uruurcKwLSCxbZ4,AQACAAE/Ultimate-Freenet-Index/9/ BookmarkCategory0.Content.Bookmark3.Name=Entry point BookmarkCategory0.Content.Bookmark3.Description=An old, large index, wich hasn't been updated for a while BookmarkCategory0.Content.Bookmark3.hasAnActivelink=true From robert at freenetproject.org Thu Jan 3 16:11:15 2008 From: robert at freenetproject.org (robert at freenetproject.org) Date: Thu, 3 Jan 2008 16:11:15 +0000 (UTC) Subject: [freenet-cvs] r16855 - trunk/freenet/src/freenet/support/math Message-ID: <20080103161115.C919F47AED4@freenetproject.org> Author: robert Date: 2008-01-03 16:11:15 +0000 (Thu, 03 Jan 2008) New Revision: 16855 Modified: trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java Log: store normalized values for DecayingKeyspaceAverager Modified: trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java =================================================================== --- trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java 2008-01-03 14:25:46 UTC (rev 16854) +++ trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java 2008-01-03 16:11:15 UTC (rev 16855) @@ -66,6 +66,17 @@ public synchronized double currentValue() { return currentValue; } + + /** + * Not a public method. Changes the internally stored currentValue, returning the old one. + * Used from DecayingKeyspaceAverager to normalize the stored averages. Calling this function + * may (purposefully) destroy the utility of the average being kept. + */ + synchronized double setCurrentValue(double d) { + double old=currentValue; + currentValue=d; + return old; + } public synchronized void report(double d) { if(d < min) { Modified: trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java =================================================================== --- trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java 2008-01-03 14:25:46 UTC (rev 16854) +++ trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java 2008-01-03 16:11:15 UTC (rev 16855) @@ -15,15 +15,12 @@ */ public class DecayingKeyspaceAverage implements RunningAverage { /** - 'avg' is the non-normalized average location. + 'avg' is the normalized average location, note that the the reporting bounds are (-2.0, 2.0) however. */ BootstrappingDecayingRunningAverage avg; - //If the keyspace averager wraps more than this number of times, an exception will be thrown. - public final static int WRAP_WARNING=1000; - public DecayingKeyspaceAverage(double defaultValue, int maxReports, SimpleFieldSet fs) { - avg=new BootstrappingDecayingRunningAverage(defaultValue, -WRAP_WARNING, WRAP_WARNING, maxReports, fs); + avg=new BootstrappingDecayingRunningAverage(defaultValue, -2.0, 2.0, maxReports, fs); } public DecayingKeyspaceAverage(BootstrappingDecayingRunningAverage a) { @@ -36,7 +33,7 @@ } public synchronized double currentValue() { - return Location.normalize(avg.currentValue()); + return avg.currentValue(); } public synchronized void report(double d) { @@ -57,10 +54,10 @@ diff = +0.3; //the diff from the normalized values; Location.change(0.9, 0.2); avg.report(2.2);//to successfully move the average towards the closest route to the given value. */ - //System.err.println("debug: "+superValue+", "+thisValue+", "+diff+", "+(superValue+diff)+", "+Location.normalize(superValue+diff)); - if (toAverage>WRAP_WARNING || toAverage<-WRAP_WARNING) - Logger.error(this, "DecayingKeyspaceAverage is wrapped up too many times"); avg.report(toAverage); + double newValue=avg.currentValue(); + if (newValue < 0.0 || newValue > 1.0) + avg.setCurrentValue(Location.normalize(newValue)); } public synchronized double valueIfReported(double d) { From nextgens at freenetproject.org Thu Jan 3 16:15:23 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Thu, 3 Jan 2008 16:15:23 +0000 (UTC) Subject: [freenet-cvs] r16856 - trunk/freenet/src/freenet/clients/http Message-ID: <20080103161523.8FC5347B7A2@freenetproject.org> Author: nextgens Date: 2008-01-03 16:15:23 +0000 (Thu, 03 Jan 2008) New Revision: 16856 Modified: trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java Log: ConnectionToadlet: don't display the "add a peer" box for opennet Modified: trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java =================================================================== --- trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java 2008-01-03 16:11:15 UTC (rev 16855) +++ trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java 2008-01-03 16:15:23 UTC (rev 16856) @@ -466,9 +466,10 @@ } // END PEER TABLE } - - drawAddPeerBox(contentNode, ctx); + if(!isOpennet()) + drawAddPeerBox(contentNode, ctx); + // our reference if(shouldDrawNoderefBox(advancedModeEnabled)) drawNoderefBox(contentNode, ctx); From nextgens at freenetproject.org Thu Jan 3 16:23:39 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Thu, 3 Jan 2008 16:23:39 +0000 (UTC) Subject: [freenet-cvs] r16857 - trunk/apps/new_installer/res/windows/bin Message-ID: <20080103162339.93E2C47AB05@freenetproject.org> Author: nextgens Date: 2008-01-03 16:23:39 +0000 (Thu, 03 Jan 2008) New Revision: 16857 Modified: trunk/apps/new_installer/res/windows/bin/install_wrapper.cmd Log: new_installer: second part of r16850 Modified: trunk/apps/new_installer/res/windows/bin/install_wrapper.cmd =================================================================== --- trunk/apps/new_installer/res/windows/bin/install_wrapper.cmd 2008-01-03 16:15:23 UTC (rev 16856) +++ trunk/apps/new_installer/res/windows/bin/install_wrapper.cmd 2008-01-03 16:23:39 UTC (rev 16857) @@ -25,14 +25,6 @@ @echo fcp.enable=true >>freenet.ini @echo fcp.port=%FCP_PORT% >>freenet.ini -:: Try to detect a free, available port for console - at set CONSOLE_PORT=2323 - at java -jar bin\bindtest.jar %CONSOLE_PORT% - at if not errorlevel 0 set CONSOLE_PORT=2324 - at echo console.enable=true >>freenet.ini - at echo console.port=%CONSOLE_PORT% >>freenet.ini - - @bin\cat.exe wrapper.conf | bin\sed.exe "s/darknet/darknet-%FPROXY_PORT%/g" > wrapper2.conf @move /Y wrapper2.conf wrapper.conf > NUL From nextgens at freenetproject.org Thu Jan 3 16:53:28 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Thu, 3 Jan 2008 16:53:28 +0000 (UTC) Subject: [freenet-cvs] r16858 - trunk/freenet/src/freenet/clients/http Message-ID: <20080103165328.DDED347BC45@freenetproject.org> Author: nextgens Date: 2008-01-03 16:53:28 +0000 (Thu, 03 Jan 2008) New Revision: 16858 Modified: trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java trunk/freenet/src/freenet/clients/http/OpennetConnectionsToadlet.java Log: ConnectionToadlet: same fix with different code Modified: trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java =================================================================== --- trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java 2008-01-03 16:23:39 UTC (rev 16857) +++ trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java 2008-01-03 16:53:28 UTC (rev 16858) @@ -467,8 +467,7 @@ // END PEER TABLE } - if(!isOpennet()) - drawAddPeerBox(contentNode, ctx); + drawAddPeerBox(contentNode, ctx); // our reference if(shouldDrawNoderefBox(advancedModeEnabled)) Modified: trunk/freenet/src/freenet/clients/http/OpennetConnectionsToadlet.java =================================================================== --- trunk/freenet/src/freenet/clients/http/OpennetConnectionsToadlet.java 2008-01-03 16:23:39 UTC (rev 16857) +++ trunk/freenet/src/freenet/clients/http/OpennetConnectionsToadlet.java 2008-01-03 16:53:28 UTC (rev 16858) @@ -27,6 +27,10 @@ PeerNodeStatus peerNodeStatus, boolean fProxyJavascriptEnabled) { // Do nothing - no private notes either (no such thing as negative trust in cyberspace) } + + protected void drawAddPeerBox(HTMLNode contentNode, ToadletContext ctx) { + // Do nothing - we don't want opennet-refs dealing + } protected boolean hasNameColumn() { return false; From toad at freenetproject.org Thu Jan 3 17:13:03 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 17:13:03 +0000 (UTC) Subject: [freenet-cvs] r16859 - trunk/website/pages/en Message-ID: <20080103171303.0FFDB479FBC@freenetproject.org> Author: toad Date: 2008-01-03 17:13:02 +0000 (Thu, 03 Jan 2008) New Revision: 16859 Modified: trunk/website/pages/en/connect.php Log: Update connect page about insecure mode (opennet) Modified: trunk/website/pages/en/connect.php =================================================================== --- trunk/website/pages/en/connect.php 2008-01-03 16:53:28 UTC (rev 16858) +++ trunk/website/pages/en/connect.php 2008-01-03 17:13:02 UTC (rev 16859) @@ -1,13 +1,20 @@

Connecting to Freenet

+

There are two ways to connect to Freenet:

+

-In order to connect to Freenet, you have to exchange Node references with other users of Freenet. The references -must be added on both sides to be established. That is, you need to add his/hers, and he/she needs to add yours. +In practice, you should probably use both of these options, unless you are really paranoid, in which +case you should of course only connect to people you trust. Insecure mode should work automatically +once enabled, so the rest of this page is about connecting to Friends.

-Note: You cannot use Freenet without peers. +To connect to your friends' nodes, you have to exchange Node references with them. The references +must be added on both sides to be established. That is, you need to add his/hers, and he/she needs to add yours.

-When you have a freshly connected node, the routing tables are empty, and therefore requests are sent +When you have a freshly connected node, you have no data cached in your datastore, +and very few connections even if insecure mode is enabled. Requests are sent out in a random fashion. This makes some (or all) requests time out before retrieving anything. It takes a couple of days for your Freenet-node to get up to speed, so please don't get discouraged by this. @@ -16,8 +23,10 @@ You should have at least three nodes that are connected to you at all times, ideally at least five to seven. Since some nodes may be unreachable at times, you need to connect to some more nodes to get the expected number. The nodes that are connected directly to you are the only nodes on freenet that might see what kind of traffic that passes -through to your Freenet node. These are also the only nodes that you can see on the network, the others are hidden -from you. +through to your Freenet node. But if insecure mode is enabled, any node can find yours; this is the big +advantage of not enabling insecure mode: you are effectively invisible except to your Friends. +In practice most people start off with insecure mode and gradually add Friends, and hopefully turn off +insecure mode once they have at least 10 Friends.


From nextgens at freenetproject.org Thu Jan 3 17:48:08 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Thu, 3 Jan 2008 17:48:08 +0000 (UTC) Subject: [freenet-cvs] r16860 - trunk/freenet/src/freenet/clients/http Message-ID: <20080103174808.E487247BC1D@freenetproject.org> Author: nextgens Date: 2008-01-03 17:48:08 +0000 (Thu, 03 Jan 2008) New Revision: 16860 Modified: trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java trunk/freenet/src/freenet/clients/http/OpennetConnectionsToadlet.java Log: see http://archives.freenetproject.org/message/20080103.172411.d7a47d3e.en.html Modified: trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java =================================================================== --- trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java 2008-01-03 17:13:02 UTC (rev 16859) +++ trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java 2008-01-03 17:48:08 UTC (rev 16860) @@ -467,11 +467,11 @@ // END PEER TABLE } - drawAddPeerBox(contentNode, ctx); - // our reference - if(shouldDrawNoderefBox(advancedModeEnabled)) + if(shouldDrawNoderefBox(advancedModeEnabled)) { + drawAddPeerBox(contentNode, ctx); drawNoderefBox(contentNode, ctx); + } // our ports HTMLNode portInfobox = contentNode.addChild("div", "class", "infobox infobox-normal"); Modified: trunk/freenet/src/freenet/clients/http/OpennetConnectionsToadlet.java =================================================================== --- trunk/freenet/src/freenet/clients/http/OpennetConnectionsToadlet.java 2008-01-03 17:13:02 UTC (rev 16859) +++ trunk/freenet/src/freenet/clients/http/OpennetConnectionsToadlet.java 2008-01-03 17:48:08 UTC (rev 16860) @@ -27,10 +27,6 @@ PeerNodeStatus peerNodeStatus, boolean fProxyJavascriptEnabled) { // Do nothing - no private notes either (no such thing as negative trust in cyberspace) } - - protected void drawAddPeerBox(HTMLNode contentNode, ToadletContext ctx) { - // Do nothing - we don't want opennet-refs dealing - } protected boolean hasNameColumn() { return false; @@ -57,8 +53,7 @@ } protected boolean shouldDrawNoderefBox(boolean advancedModeEnabled) { - // Developers may want to see the noderef. - return advancedModeEnabled; + return false; } protected boolean showPeerActionsBox() { From toad at freenetproject.org Thu Jan 3 17:51:34 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 17:51:34 +0000 (UTC) Subject: [freenet-cvs] r16861 - trunk/freenet/src/freenet/node Message-ID: <20080103175134.53CA947BBE8@freenetproject.org> Author: toad Date: 2008-01-03 17:51:33 +0000 (Thu, 03 Jan 2008) New Revision: 16861 Modified: trunk/freenet/src/freenet/node/PeerNode.java Log: Fetch ARK even if verifiedIncompatibleNewer-/Older-Version. IIRC this was set ages ago, and is the result of us actually disconnecting from incompatible nodes, long ago. It doesn't make sense. Modified: trunk/freenet/src/freenet/node/PeerNode.java =================================================================== --- trunk/freenet/src/freenet/node/PeerNode.java 2008-01-03 17:48:08 UTC (rev 16860) +++ trunk/freenet/src/freenet/node/PeerNode.java 2008-01-03 17:51:33 UTC (rev 16861) @@ -1235,7 +1235,7 @@ if(successfulHandshakeSend) firstHandshake = false; handshakeCount++; - return ((handshakeCount == MAX_HANDSHAKE_COUNT) && !(verifiedIncompatibleOlderVersion || verifiedIncompatibleNewerVersion)); + return handshakeCount == MAX_HANDSHAKE_COUNT; } } From robert at freenetproject.org Thu Jan 3 18:06:15 2008 From: robert at freenetproject.org (robert at freenetproject.org) Date: Thu, 3 Jan 2008 18:06:15 +0000 (UTC) Subject: [freenet-cvs] r16862 - trunk/freenet/src/freenet/node Message-ID: <20080103180615.94DB447B81B@freenetproject.org> Author: robert Date: 2008-01-03 18:06:15 +0000 (Thu, 03 Jan 2008) New Revision: 16862 Modified: trunk/freenet/src/freenet/node/PeerNode.java Log: revert r16833 & r16834: ark is now always fetched (r16861) Modified: trunk/freenet/src/freenet/node/PeerNode.java =================================================================== --- trunk/freenet/src/freenet/node/PeerNode.java 2008-01-03 17:51:33 UTC (rev 16861) +++ trunk/freenet/src/freenet/node/PeerNode.java 2008-01-03 18:06:15 UTC (rev 16862) @@ -348,7 +348,7 @@ disableRoutingHasBeenSetRemotely = false; // Assume so lastGoodVersion = fs.get("lastGoodVersion"); - //updateShouldDisconnectNow(); + updateShouldDisconnectNow(); testnetEnabled = fs.getBoolean("testnet", false); if(node.testnetEnabled != testnetEnabled) { @@ -2781,11 +2781,8 @@ } synchronized void updateShouldDisconnectNow() { - //FIXME: We should not update VERIFIED unless we HANDSHAKE WITH THE NODE - if (isConnected() || verifiedIncompatibleOlderVersion || verifiedIncompatibleNewerVersion) { verifiedIncompatibleOlderVersion = forwardInvalidVersion(); verifiedIncompatibleNewerVersion = reverseInvalidVersion(); - } } /** From toad at freenetproject.org Thu Jan 3 21:26:57 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 21:26:57 +0000 (UTC) Subject: [freenet-cvs] r16863 - trunk/freenet/src/freenet/l10n Message-ID: <20080103212657.D479F47BC63@freenetproject.org> Author: toad Date: 2008-01-03 21:26:57 +0000 (Thu, 03 Jan 2008) New Revision: 16863 Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties Log: L10n entry for acceptSeedConnections. Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties =================================================================== --- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-01-03 18:06:15 UTC (rev 16862) +++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-01-03 21:26:57 UTC (rev 16863) @@ -562,6 +562,8 @@ N2NTMUserAlert.header=From: ${from} (composed ${composed} | sent ${sent} | received ${received}) N2NTMUserAlert.reply=Reply N2NTMUserAlert.title=Node to Node Text Message ${number} from ${peername} (${peer}) +Node.acceptSeedConnectionsShort=Be a seednode? +Node.acceptSeedConnections=If true, the node will accept connections from new insecure-mode nodes and help to bootstrap them onto the network. This allows any node with your noderef to connect, but only for purposes of announcement: it can only do requests to nodes that it gets through the announcement (possibly including this node if we don't have many Strangers). Node.alwaysAllowLocalAddresses=Always allow connecting to nodes via local addresses? Node.alwaysAllowLocalAddressesLong=If true, the node will attempt to connect to nodes via their local (localhost, LAN) addresses as well as their public IPs. If this is not set, you can still enable it for specific darknet peers (but not opennet peers). Set this if you want to connect to other nodes on the same LAN or computer, and don't mind that bogus references can cause your node to send UDP packets to machines on your LAN. Node.assumeNATed=Assume the port is not forwarded. From toad at freenetproject.org Thu Jan 3 21:41:53 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 21:41:53 +0000 (UTC) Subject: [freenet-cvs] r16865 - trunk/freenet/src/freenet/store Message-ID: <20080103214153.0E1D547AAC8@freenetproject.org> Author: toad Date: 2008-01-03 21:41:52 +0000 (Thu, 03 Jan 2008) New Revision: 16865 Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java Log: comment Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java =================================================================== --- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-03 21:28:31 UTC (rev 16864) +++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-03 21:41:52 UTC (rev 16865) @@ -1928,7 +1928,7 @@ long blockNum; - //FIXME: What's the point of this loop? + // Keep trying until we succeed. while(true) { if((blockNum = grabFreeBlock()) >= 0) { if(logMINOR) From robert at freenetproject.org Thu Jan 3 23:00:36 2008 From: robert at freenetproject.org (robert at freenetproject.org) Date: Thu, 3 Jan 2008 23:00:36 +0000 (UTC) Subject: [freenet-cvs] r16866 - trunk/freenet/src/freenet/node Message-ID: <20080103230037.00A84479F6D@freenetproject.org> Author: robert Date: 2008-01-03 23:00:36 +0000 (Thu, 03 Jan 2008) New Revision: 16866 Modified: trunk/freenet/src/freenet/node/CHKInsertSender.java Log: Fix deadlock (and generally-bad-idea), waitForBackgroundTransfers() will already terminate when receiveFailed is true. ============================= Found one Java-level deadlock: ============================= "CHKInsertSender for UID -3348306612631418760 on 35322 at 1199063086969": waiting to lock monitor 0x020c2234 (object 0x1bd30fc0, a freenet.node.CHKInsertSender), which is held by "InsertHandler$DataReceiver for UID -3348306612631418760" "InsertHandler$DataReceiver for UID -3348306612631418760": waiting to lock monitor 0x0212c068 (object 0x1bd31208, a java.util.Vector), which is held by "CHKInsertSender for UID -3348306612631418760 on 35322 at 1199063086969" Java stack information for the threads listed above: =================================================== "CHKInsertSender for UID -3348306612631418760 on 35322 at 1199063086969": at freenet.node.CHKInsertSender.setTransferTimedOut(CHKInsertSender.java:583) - waiting to lock <0x1bd30fc0> (a freenet.node.CHKInsertSender) at freenet.node.CHKInsertSender.waitForBackgroundTransferCompletions(CHKInsertSender.java:708) at freenet.node.CHKInsertSender.finish(CHKInsertSender.java:620) - locked <0x1bd31208> (a java.util.Vector) at freenet.node.CHKInsertSender.realRun(CHKInsertSender.java:548) at freenet.node.CHKInsertSender.run(CHKInsertSender.java:234) at freenet.support.PooledExecutor$MyThread.run(PooledExecutor.java:129) "InsertHandler$DataReceiver for UID -3348306612631418760": at java.util.Vector.removeAllElements(Vector.java:621) - waiting to lock <0x1bd31208> (a java.util.Vector) at java.util.Vector.clear(Vector.java:812) at freenet.node.CHKInsertSender.receiveFailed(CHKInsertSender.java:662) - locked <0x1bd30fc0> (a freenet.node.CHKInsertSender) at freenet.node.InsertHandler$DataReceiver.run(InsertHandler.java:436) at freenet.support.PooledExecutor$MyThread.run(PooledExecutor.java:129) Modified: trunk/freenet/src/freenet/node/CHKInsertSender.java =================================================================== --- trunk/freenet/src/freenet/node/CHKInsertSender.java 2008-01-03 21:41:52 UTC (rev 16865) +++ trunk/freenet/src/freenet/node/CHKInsertSender.java 2008-01-03 23:00:36 UTC (rev 16866) @@ -658,8 +658,6 @@ synchronized(this) { status = RECEIVE_FAILED; allTransfersCompleted = true; - //FIXME: Won't this leak unclaimed FIFO elements? - backgroundTransfers.clear(); // Effectively ... we certainly don't want to wait for it. notifyAll(); } // Do not call finish(), that can only be called on the main thread and it will block. From tommy at freenetproject.org Thu Jan 3 23:17:13 2008 From: tommy at freenetproject.org (tommy at freenetproject.org) Date: Thu, 3 Jan 2008 23:17:13 +0000 (UTC) Subject: [freenet-cvs] r16867 - trunk/freenet/src/freenet/l10n Message-ID: <20080103231713.A832F47A326@freenetproject.org> Author: tommy Date: 2008-01-03 23:17:12 +0000 (Thu, 03 Jan 2008) New Revision: 16867 Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.de.properties Log: l10n: update to german translation Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.de.properties =================================================================== --- trunk/freenet/src/freenet/l10n/freenet.l10n.de.properties 2008-01-03 23:00:36 UTC (rev 16866) +++ trunk/freenet/src/freenet/l10n/freenet.l10n.de.properties 2008-01-03 23:17:12 UTC (rev 16867) @@ -83,6 +83,7 @@ ConfigToadlet.reset=Zur?cksetzen ConfigToadlet.returnToNodeConfig=Zur Knoten-Konfiguration zur?ckkehren ConfigToadlet.shortTitle=Konfiguration +ConfigToadlet.ssl=SSL (damit die Einstellungen ?bernommen werden, muss Freenet neu gestartet werden) ConfigToadlet.title=Freenet-Knoten-Konfiguration ConfigToadlet.toadletsymlinker=ToadletSymlinker ConfigToadlet.true=ja @@ -316,6 +317,8 @@ FcpServer.isEnabledLong=Ist der FCP-Server aktiviert? FcpServer.portNumber=FCP-Port-Nummer FcpServer.portNumberLong=FCP-Port-Nummer. +FcpServer.ssl=SSL aktivieren? +FcpServer.sslLong=SSL aktivieren? FetchException.longError.1=Zu viele Ebenen von Rekursion (Schachtelung) in den Archiven FetchException.longError.10=Datei nicht im Archiv FetchException.longError.11=Zu viele Pfad-Komponenten - kein Manifest(???)? Versuchen Sie eine zu entfernen @@ -882,6 +885,16 @@ RequestStarterGroup.schedulerLong=Das Priorit?ts-Verfahren, das vom Planer genutzt wird, einstellen. RevocationKeyFoundUserAlert.text=Ihr Knoten hat den Widerrufs-Schl?ssel der automatischen Aktualisierung im Netzwerk gefunden. Das hei?t, dass unser automatisches Aktualisierungs-System wahrscheinlich KOMPROMITTIERT (blo?gestellt/offen gelegt) wurde! Deshalb wurde es auf Ihrem Knoten deaktiviert, um zu verhindern, dass "b?se Sachen" installiert werden. Wir empfehlen Ihnen dringend, auf der Internet-Seite des Projekts nachzusehen ob Aktualisierungen verf?gbar sind. Bitte achten Sie darauf zu pr?fen, dass die Internet-Seite nicht gef?lscht wurde. Die Widerrufs-Nachricht lautet: ${message}. RevocationKeyFoundUserAlert.title=Der private Schl?ssel des Projekts wurde kompromittiert (offengelegt)! +SSL.enable=SSL Unterst?tzung aktivieren? +SSL.enableLong=SSL Unterst?tzung aktivieren? +SSL.keyPass=Passwort fur den privaten Schl?ssel +SSL.keyPassLong=Passwort f?r den privaten Schl?ssel +SSL.keyStore=Name und Pfad zur Schl?sseldatei +SSL.keyStoreLong=Name und Pfad der Schl?sseldatei +SSL.keyStorePass=Passwort f?r die Schl?sseldatei +SSL.keyStorePassLong=Passwort f?r die Schl?sseldatei +SSL.version=SSL Version +SSL.versionLong=SSL Version, SSLv3 oder TLSv1 (Standard: SSLv3) ShortOption.parseError=Kann den Wert nicht als String-Array (Zeichenfolgen-Feld) erkennen: ${error} SimpleToadletServer.advancedMode=Erweiterten Modus aktivieren? SimpleToadletServer.advancedModeLong=Ob Informationen f?r fortgeschrittene Benutzer/Ger?te angezeigt werden sollen oder nicht. Diese Einstellung sollte in den meisten F?llen auf "nein" stehen. @@ -910,6 +923,8 @@ SimpleToadletServer.panicButtonLong=Ob der Alarm-Knopf auf der Warteschlangen-Seite (/queue/) angezeigt werden soll oder nicht. SimpleToadletServer.port=FProxy-Port-Nummer SimpleToadletServer.portLong=FProxy-Port-Nummer +SimpleToadletServer.ssl=SSL aktivieren? +SimpleToadletServer.sslLong=SSL aktivieren? StaticToadlet.pathInvalidChars=Der angegebene URI enth?lt nicht erlaubte Zeichen. StaticToadlet.pathNotFound=Der Pfad, den Sie angegeben haben, existiert nicht. StaticToadlet.pathNotFoundTitle=Pfad nicht gefunden @@ -956,6 +971,8 @@ TextModeClientInterfaceServer.enableInputOutputLong=Text-Modus-Client-Schnittstelle in der Standard-Ein-/Ausgabe aktivieren? (.enabled (.aktiviert) bezieht sich auf das stellen eines Servers im Telnet-Stil, dieser f?hrt es ?ber einen Sockel (Socket) aus) TextModeClientInterfaceServer.enabled=TMCI aktivieren TextModeClientInterfaceServer.enabledLong=Ob das TMCI aktiviert werden soll +TextModeClientInterfaceServer.ssl=SSL aktivieren? +TextModeClientInterfaceServer.sslLong=SSL aktivieren? TextModeClientInterfaceServer.telnetPortNumber=Telnet-Port TextModeClientInterfaceServer.telnetPortNumberLong=Telnet-Port-Nummer TimeSkewDetectedUserAlert.text=Es wurde vom Knoten eine Zeitversetzung erkannt. Das ist SEHR schlimm. Ihr Knoten wird nicht richtig laufen bis dies behoben ist; h?ufige Ursachen sind ein falsch konfigurierter Energie-Spar-Modus, Netzwerk-Zeit-Synchronisations-Programme, oder fehlerhafte Hardware. From toad at freenetproject.org Thu Jan 3 23:45:04 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 23:45:04 +0000 (UTC) Subject: [freenet-cvs] r16868 - trunk/freenet/src/freenet/node Message-ID: <20080103234504.3B7A0479F76@freenetproject.org> Author: toad Date: 2008-01-03 23:45:03 +0000 (Thu, 03 Jan 2008) New Revision: 16868 Modified: trunk/freenet/src/freenet/node/Version.java Log: 1097: (Mandatory 7 jan) L10n: - German update by tommy. Link layer: - Maybe fix connection setup breaking in some cases. - Fix a rare NPE in the later stages of JFK connection setup. - Increase incoming UDP buffer to 64K to avoid losing packets on Windows. See http://lists.zooko.com/pipermail/p2p-hackers/2007-December/001474.html. - Refactor _fillJFKDHFIFO(). - Always fetch ARKs if disconnected, even if we've connected before and found that the node is out of date and non-routable. A long time ago we would connect and then disconnect; now we stay connected, so we don't need to avoid fetching the ARK. Requests: - InsertHandler: Use sendSync to avoid the message filter timing out. - CHKInsertSender: Don't clear background transfers in receiveFailed(). This serves no purpose (waitForBackgroundTransfers() will exit on receive failed anyway), and causes a deadlock. Opennet: - New option node.acceptSeedConnections. On by default, if disabled, or if opennet is off, don't accept seed connections. Fproxy: - Make the unknown/dangerous MIME type warning page look a bit more like the too big page. Add a download-in-background link and show the mime type and file size. Suggested by Generalis Anonymous on Frost I think. Trivial refactoring supporting this. GCJ fixes: - If max memory is infinite, don't reject any request based on memory usage. - Fix similar problem with databaseMaxMemory check - it wasn't possible to increase it on GCJ. - Work around a bug in GCJ InputStreamReader.refill() that was breaking the HTML filter code. Client layer: - Fix an NPE when fetching sub-metadata in containers (or something like that). Web interface: - Update default bookmark editions. - Don't show the noderef box on the Strangers page. Stats: - Simplify the location movement stats code. - New DecayingKeyspaceAverage uses BootstrappingDecayingRunningAverage but designed for keyspace locations; it wraps properly. - Persist the datastore/request average locations. - Cap store stats accuracy estimate at 100%. - Log rejection reasons for unresponsive peers. Bulk data transfer: - Wait an extra 10 seconds for the FNPBulkReceivedAll. Dev stuff: - Indenting. - Logging. - Prevent rare IllegalArgumentException in logging code. - Refactoring. Performance: - Minor synchronization improvement. Contrib (freenet-ext.jar, not built yet): - Delete unnecessary resources left over from prev BDB version. Support scripts: - Quote FILENAME in verify_indent_client.sh and verify_indent.sh Installer: - Turn off TMCI console by default. mrogers nextgens robert toad tommy xor 0.5 (jolantern): * beautified source, fixed a few typos * fixed off-by-one error in boundary check in removeBookmark() and updateBookmark() * bookmarks can now be moved up and down * Empty fields in bookmarks are overwritten by fields of the hard coded default bookmarks. This appears to be the desired behavior of the configurator. Therefore fill in empty fields with default values (in the case of the ActiveLink file, some random characters are added) * declared inner class Bookmark non-static * html-encode & in some places * more indenting etc * show "(active link missing)" when there is none. Web site updates: - Point to /wizard/ if the browser doesn't come up automatically. - Explain that, explain opennet. - Update the connect.html documentation page. Modified: trunk/freenet/src/freenet/node/Version.java =================================================================== --- trunk/freenet/src/freenet/node/Version.java 2008-01-03 23:17:12 UTC (rev 16867) +++ trunk/freenet/src/freenet/node/Version.java 2008-01-03 23:45:03 UTC (rev 16868) @@ -24,17 +24,17 @@ public static final String protocolVersion = "1.0"; /** The build number of the current revision */ - private static final int buildNumber = 1096; + private static final int buildNumber = 1097; /** Oldest build of Fred we will talk to */ private static final int oldLastGoodBuild = 1094; - private static final int newLastGoodBuild = 1096; + private static final int newLastGoodBuild = 1097; static final long transitionTime; static { final Calendar _cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); // year, month - 1 (or constant), day, hour, minute, second - _cal.set( 2007, Calendar.DECEMBER, 24, 0, 0, 0 ); + _cal.set( 2008, Calendar.JANUARY, 7, 0, 0, 0 ); transitionTime = _cal.getTimeInMillis(); } From toad at freenetproject.org Thu Jan 3 23:58:06 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Thu, 3 Jan 2008 23:58:06 +0000 (UTC) Subject: [freenet-cvs] r16869 - trunk/freenet/src/freenet/node Message-ID: <20080103235806.7035D47BC18@freenetproject.org> Author: toad Date: 2008-01-03 23:58:06 +0000 (Thu, 03 Jan 2008) New Revision: 16869 Modified: trunk/freenet/src/freenet/node/SeedClientPeerNode.java Log: Do not fetch the ARK of a seednode client. Modified: trunk/freenet/src/freenet/node/SeedClientPeerNode.java =================================================================== --- trunk/freenet/src/freenet/node/SeedClientPeerNode.java 2008-01-03 23:45:03 UTC (rev 16868) +++ trunk/freenet/src/freenet/node/SeedClientPeerNode.java 2008-01-03 23:58:06 UTC (rev 16869) @@ -79,4 +79,8 @@ protected boolean ignoreLastGoodVersion() { return true; } + + void startARKFetcher() { + // Do not start an ARK fetcher. + } } From robert at freenetproject.org Fri Jan 4 00:27:20 2008 From: robert at freenetproject.org (robert at freenetproject.org) Date: Fri, 4 Jan 2008 00:27:20 +0000 (UTC) Subject: [freenet-cvs] r16870 - trunk/freenet/src/freenet/node Message-ID: <20080104002720.3B37F47BC73@freenetproject.org> Author: robert Date: 2008-01-04 00:27:19 +0000 (Fri, 04 Jan 2008) New Revision: 16870 Modified: trunk/freenet/src/freenet/node/PacketSender.java trunk/freenet/src/freenet/node/PeerNode.java Log: rename identifiers with changed meaning Modified: trunk/freenet/src/freenet/node/PacketSender.java =================================================================== --- trunk/freenet/src/freenet/node/PacketSender.java 2008-01-03 23:58:06 UTC (rev 16869) +++ trunk/freenet/src/freenet/node/PacketSender.java 2008-01-04 00:27:19 UTC (rev 16870) @@ -137,7 +137,7 @@ PeerNode[] nodes = node.peers.myPeers; for(int i = 0; i < nodes.length; i++) { PeerNode pn = nodes[i]; - pn.updateShouldDisconnectNow(); + pn.updateVersionRoutablity(); } } }, transition - now); Modified: trunk/freenet/src/freenet/node/PeerNode.java =================================================================== --- trunk/freenet/src/freenet/node/PeerNode.java 2008-01-03 23:58:06 UTC (rev 16869) +++ trunk/freenet/src/freenet/node/PeerNode.java 2008-01-04 00:27:19 UTC (rev 16870) @@ -84,11 +84,11 @@ /** Set to true based on a relevant incoming handshake from this peer * Set true if this peer has a incompatible older build than we are */ - protected boolean verifiedIncompatibleOlderVersion; + protected boolean unroutableOlderVersion; /** Set to true based on a relevant incoming handshake from this peer * Set true if this peer has a incompatible newer build than we are */ - protected boolean verifiedIncompatibleNewerVersion; + protected boolean unroutableNewerVersion; protected boolean disableRouting; protected boolean disableRoutingHasBeenSetLocally; protected boolean disableRoutingHasBeenSetRemotely; @@ -348,7 +348,7 @@ disableRoutingHasBeenSetRemotely = false; // Assume so lastGoodVersion = fs.get("lastGoodVersion"); - updateShouldDisconnectNow(); + updateVersionRoutablity(); testnetEnabled = fs.getBoolean("testnet", false); if(node.testnetEnabled != testnetEnabled) { @@ -867,16 +867,16 @@ * Is this peer too old for us? (i.e. our lastGoodVersion is newer than it's version) * */ - public synchronized boolean isVerifiedIncompatibleOlderVersion() { - return verifiedIncompatibleOlderVersion; + public synchronized boolean isUnroutableOlderVersion() { + return unroutableOlderVersion; } /** * Is this peer too new for us? (i.e. our version is older than it's lastGoodVersion) * */ - public synchronized boolean isVerifiedIncompatibleNewerVersion() { - return verifiedIncompatibleNewerVersion; + public synchronized boolean isUnroutableNewerVersion() { + return unroutableNewerVersion; } /** @@ -1219,7 +1219,7 @@ return calcNextHandshakeBurstOnly(now); synchronized(this) { long delay; - if(verifiedIncompatibleOlderVersion || verifiedIncompatibleNewerVersion || disableRouting) { + if(unroutableOlderVersion || unroutableNewerVersion || disableRouting) { // Let them know we're here, but have no hope of connecting delay = Node.MIN_TIME_BETWEEN_VERSION_SENDS + node.random.nextInt(Node.RANDOMIZED_TIME_BETWEEN_VERSION_SENDS); } else if(invalidVersion() && !firstHandshake) { @@ -1678,8 +1678,8 @@ isConnected = true; disableRouting = disableRoutingHasBeenSetLocally || disableRoutingHasBeenSetRemotely; isRoutable = routable; - verifiedIncompatibleNewerVersion = newer; - verifiedIncompatibleOlderVersion = older; + unroutableNewerVersion = newer; + unroutableOlderVersion = older; bootIDChanged = (thisBootID != this.bootID); if(bootIDChanged && logMINOR) Logger.minor(this, "Changed boot ID from " + bootID + " to " + thisBootID + " for " + getPeer()); @@ -1897,11 +1897,11 @@ } public boolean publicInvalidVersion() { - return verifiedIncompatibleOlderVersion; + return unroutableOlderVersion; } public synchronized boolean publicReverseInvalidVersion() { - return verifiedIncompatibleNewerVersion; + return unroutableNewerVersion; } public synchronized boolean dontRoute() { @@ -2002,7 +2002,7 @@ } lastGoodVersion = fs.get("lastGoodVersion"); - updateShouldDisconnectNow(); + updateVersionRoutablity(); String locationString = fs.get("location"); if(locationString != null) { @@ -2700,9 +2700,9 @@ } } else if(isConnected() && bogusNoderef) peerNodeStatus = PeerManager.PEER_NODE_STATUS_CONN_ERROR; - else if(isConnected() && verifiedIncompatibleNewerVersion) + else if(isConnected() && unroutableNewerVersion) peerNodeStatus = PeerManager.PEER_NODE_STATUS_TOO_NEW; - else if(isConnected && verifiedIncompatibleOlderVersion) + else if(isConnected && unroutableOlderVersion) peerNodeStatus = PeerManager.PEER_NODE_STATUS_TOO_OLD; else if(isConnected && disableRouting) peerNodeStatus = PeerManager.PEER_NODE_STATUS_ROUTING_DISABLED; @@ -2780,9 +2780,9 @@ return handshakeCount; } - synchronized void updateShouldDisconnectNow() { - verifiedIncompatibleOlderVersion = forwardInvalidVersion(); - verifiedIncompatibleNewerVersion = reverseInvalidVersion(); + synchronized void updateVersionRoutablity() { + unroutableOlderVersion = forwardInvalidVersion(); + unroutableNewerVersion = reverseInvalidVersion(); } /** @@ -2792,7 +2792,7 @@ public synchronized boolean noLongerRoutable() { // TODO: We should disconnect here if "protocol version mismatch", maybe throwing an exception // TODO: shouldDisconnectNow() is hopefully only called when we're connected, otherwise we're breaking the meaning of verifiedIncompable[Older|Newer]Version - if(verifiedIncompatibleNewerVersion || verifiedIncompatibleOlderVersion || disableRouting) + if(unroutableNewerVersion || unroutableOlderVersion || disableRouting) return true; return false; } From robert at freenetproject.org Fri Jan 4 01:53:40 2008 From: robert at freenetproject.org (robert at freenetproject.org) Date: Fri, 4 Jan 2008 01:53:40 +0000 (UTC) Subject: [freenet-cvs] r16871 - trunk/freenet/src/freenet/node Message-ID: <20080104015340.9043247BBD6@freenetproject.org> Author: robert Date: 2008-01-04 01:53:40 +0000 (Fri, 04 Jan 2008) New Revision: 16871 Modified: trunk/freenet/src/freenet/node/PeerNode.java Log: comments Modified: trunk/freenet/src/freenet/node/PeerNode.java =================================================================== --- trunk/freenet/src/freenet/node/PeerNode.java 2008-01-04 00:27:19 UTC (rev 16870) +++ trunk/freenet/src/freenet/node/PeerNode.java 2008-01-04 01:53:40 UTC (rev 16871) @@ -81,13 +81,15 @@ public abstract class PeerNode implements PeerContext, USKRetrieverCallback { private String lastGoodVersion; - /** Set to true based on a relevant incoming handshake from this peer - * Set true if this peer has a incompatible older build than we are - */ + /** + * True if this peer has a build number older than our last-known-good build number. + * Note that even if this is true, the node can still be 'connected'. + */ protected boolean unroutableOlderVersion; - /** Set to true based on a relevant incoming handshake from this peer - * Set true if this peer has a incompatible newer build than we are - */ + /** + * True if this peer reports that our build number is before their last-known-good build number. + * Note that even if this is true, the node can still be 'connected'. + */ protected boolean unroutableNewerVersion; protected boolean disableRouting; protected boolean disableRoutingHasBeenSetLocally; @@ -158,7 +160,7 @@ private int handshakeCount; /** After this many failed handshakes, we start the ARK fetcher. */ private static final int MAX_HANDSHAKE_COUNT = 2; - /** Current location in the keyspace */ + /** Current location in the keyspace, or -1 if it is unknown */ private double currentLocation; /** Node identity; for now a block of data, in future a * public key (FIXME). Cannot be changed. @@ -850,47 +852,54 @@ } /** - * What is my current keyspace location? + * Returns this peer's current keyspace location, or -1 if it is unknown. */ public synchronized double getLocation() { return currentLocation; } /** - * Returns a unique node identifier (usefull to compare 2 pn) + * Returns a unique node identifier (usefull to compare two peernodes). */ public int getIdentityHash() { return hashCode; } /** - * Is this peer too old for us? (i.e. our lastGoodVersion is newer than it's version) - * - */ + * Returns true if the last-known build number for this peer is to old to allow traffic to be routed to it. + * This does not give any indication as to the connection status of the peer. + */ public synchronized boolean isUnroutableOlderVersion() { return unroutableOlderVersion; } /** - * Is this peer too new for us? (i.e. our version is older than it's lastGoodVersion) - * - */ + * Returns true if this (or another) peer has reported to us that our build number is too old for data to be routed + * to us. In turn, we will not route data to them either. Does not strictly indicate that the peer is connected. + */ public synchronized boolean isUnroutableNewerVersion() { return unroutableNewerVersion; } /** - * Is this peer currently connected? (And routing-compatible, i.e. can we route - * requests to it, ignoring backoff) + * Returns true if requests can be routed through this peer. True if the peer's location is known, presently + * connected, and routing-compatible. That is, ignoring backoff, the peer's location is known, build number + * is compatible, and routing has not been explicitly disabled. * * Note possible deadlocks! PeerManager calls this, we call * PeerManager in e.g. verified. */ public boolean isRoutable() { + //FIXME: isConnected() is redundant if 'isRoutable', right? ... currentLocation>1.0 is impossible. return isConnected() && isRoutingCompatible() && !(currentLocation < 0.0 || currentLocation > 1.0); } + /** + * Returns true if (apart from actually knowing the peer's location), it is presumed that this peer could route requests. + * True if this peer's build number is not 'too-old' or 'too-new', actively connected, and not marked as explicity disabled. + * Does not reflect any 'backoff' logic. + */ public boolean isRoutingCompatible() { long now = System.currentTimeMillis(); synchronized(this) { @@ -1220,7 +1229,7 @@ synchronized(this) { long delay; if(unroutableOlderVersion || unroutableNewerVersion || disableRouting) { - // Let them know we're here, but have no hope of connecting + // Let them know we're here, but have no hope of routing general data to them. delay = Node.MIN_TIME_BETWEEN_VERSION_SENDS + node.random.nextInt(Node.RANDOMIZED_TIME_BETWEEN_VERSION_SENDS); } else if(invalidVersion() && !firstHandshake) { delay = Node.MIN_TIME_BETWEEN_VERSION_PROBES + node.random.nextInt(Node.RANDOMIZED_TIME_BETWEEN_VERSION_PROBES); @@ -1802,6 +1811,7 @@ Message dRouting = DMT.createRoutingStatus(!disableRoutingHasBeenSetLocally); try { + //FIXME: Why is location only if routable, and the others not? if(isRoutable()) sendAsync(locMsg, null, 0, null); sendAsync(ipMsg, null, 0, null); @@ -1896,10 +1906,16 @@ return !Version.checkArbitraryGoodVersion(Version.getVersionString(), lastGoodVersion); } + /** + * The same as isUnroutableOlderVersion, but not synchronized. + */ public boolean publicInvalidVersion() { return unroutableOlderVersion; } + /** + * The same as inUnroutableNewerVersion. + */ public synchronized boolean publicReverseInvalidVersion() { return unroutableNewerVersion; } @@ -2013,7 +2029,7 @@ currentLocation = newLoc; } } catch(FSParseException e) { - // Location is optional, we will wait for FNPLocChangeNotification + // Location is optional, we will wait for FNPLocChangeNotification. Until then we will use the last known location (or -1 if we have never known). if(logMINOR) Logger.minor(this, "Invalid or null location, waiting for FNPLocChangeNotification: " + e); } @@ -2780,18 +2796,21 @@ return handshakeCount; } + /** + * Queries the Version class to determine if this peers advertised build-number is either too-old or + * to new for the routing of requests. + */ synchronized void updateVersionRoutablity() { unroutableOlderVersion = forwardInvalidVersion(); unroutableNewerVersion = reverseInvalidVersion(); } /** - * Has the node gone from being routable to being non-routable? - * This will return true if our lastGoodBuild has changed due to a timed mandatory. + * Will return true if routing to this node is either explictly disabled, or disabled due to + * noted incompatiblity in build-version numbers. + * Logically: "not(isRoutable())", but will return false even if disconnected (meaning routing is not disabled). */ public synchronized boolean noLongerRoutable() { - // TODO: We should disconnect here if "protocol version mismatch", maybe throwing an exception - // TODO: shouldDisconnectNow() is hopefully only called when we're connected, otherwise we're breaking the meaning of verifiedIncompable[Older|Newer]Version if(unroutableNewerVersion || unroutableOlderVersion || disableRouting) return true; return false; From robert at freenetproject.org Fri Jan 4 02:10:14 2008 From: robert at freenetproject.org (robert at freenetproject.org) Date: Fri, 4 Jan 2008 02:10:14 +0000 (UTC) Subject: [freenet-cvs] r16872 - trunk/freenet/src/freenet/node Message-ID: <20080104021014.3FE6447A362@freenetproject.org> Author: robert Date: 2008-01-04 02:10:13 +0000 (Fri, 04 Jan 2008) New Revision: 16872 Modified: trunk/freenet/src/freenet/node/PeerNode.java Log: logging & fixme Modified: trunk/freenet/src/freenet/node/PeerNode.java =================================================================== --- trunk/freenet/src/freenet/node/PeerNode.java 2008-01-04 01:53:40 UTC (rev 16871) +++ trunk/freenet/src/freenet/node/PeerNode.java 2008-01-04 02:10:13 UTC (rev 16872) @@ -1650,20 +1650,21 @@ boolean newer = false; boolean older = false; if(bogusNoderef) { - Logger.normal(this, "Not connecting to " + this + " - bogus noderef"); + Logger.normal(this, "Not routing traffic to " + this + " - bogus noderef"); routable = false; + //FIXME: It looks like bogusNoderef will just be set to false a few lines later... } else if(reverseInvalidVersion()) { try { node.setNewestPeerLastGoodVersion(Version.getArbitraryBuildNumber(getLastGoodVersion())); } catch(NumberFormatException e) { // ignore } - Logger.normal(this, "Not connecting to " + this + " - reverse invalid version " + Version.getVersionString() + " for peer's lastGoodversion: " + getLastGoodVersion()); + Logger.normal(this, "Not routing traffic to " + this + " - reverse invalid version " + Version.getVersionString() + " for peer's lastGoodversion: " + getLastGoodVersion()); newer = true; } else newer = false; if(forwardInvalidVersion()) { - Logger.normal(this, "Not connecting to " + this + " - invalid version " + getVersion()); + Logger.normal(this, "Not routing traffic to " + this + " - invalid version " + getVersion()); older = true; routable = false; } else From robert at freenetproject.org Fri Jan 4 02:36:38 2008 From: robert at freenetproject.org (robert at freenetproject.org) Date: Fri, 4 Jan 2008 02:36:38 +0000 (UTC) Subject: [freenet-cvs] r16873 - trunk/freenet/src/freenet/node Message-ID: <20080104023638.378FE47BC78@freenetproject.org> Author: robert Date: 2008-01-04 02:36:37 +0000 (Fri, 04 Jan 2008) New Revision: 16873 Modified: trunk/freenet/src/freenet/node/PacketSender.java Log: comment confusing conditional Modified: trunk/freenet/src/freenet/node/PacketSender.java =================================================================== --- trunk/freenet/src/freenet/node/PacketSender.java 2008-01-04 02:10:13 UTC (rev 16872) +++ trunk/freenet/src/freenet/node/PacketSender.java 2008-01-04 02:36:37 UTC (rev 16873) @@ -201,7 +201,12 @@ pn.disconnected(false, false /* hopefully will recover, transient network glitch */); continue; } else if(pn.isRoutable() && pn.noLongerRoutable()) { - // we don't disconnect but we mark it incompatible + /* + NOTE: Whereas isRoutable() && noLongerRoutable() are generally mutually exclusive, this + code will only execute because of the scheduled-runnable in start() which executes + updateVersionRoutablity() on all our peers. We don't disconnect the peer, but mark it + as being incompatible. + */ pn.invalidate(); pn.setPeerNodeStatus(now); Logger.normal(this, "shouldDisconnectNow has returned true : marking the peer as incompatible"); From robert at freenetproject.org Fri Jan 4 03:18:42 2008 From: robert at freenetproject.org (robert at freenetproject.org) Date: Fri, 4 Jan 2008 03:18:42 +0000 (UTC) Subject: [freenet-cvs] r16874 - trunk/freenet/src/freenet/node Message-ID: <20080104031842.870CF47BBDB@freenetproject.org> Author: robert Date: 2008-01-04 03:18:41 +0000 (Fri, 04 Jan 2008) New Revision: 16874 Modified: trunk/freenet/src/freenet/node/TextModeClientInterface.java Log: trivial Modified: trunk/freenet/src/freenet/node/TextModeClientInterface.java =================================================================== --- trunk/freenet/src/freenet/node/TextModeClientInterface.java 2008-01-04 02:36:37 UTC (rev 16873) +++ trunk/freenet/src/freenet/node/TextModeClientInterface.java 2008-01-04 03:18:41 UTC (rev 16874) @@ -180,7 +180,7 @@ sb.append("PEERS - report tab delimited list of peers with name, ip+port, identity, location, status and idle time in seconds\r\n"); sb.append("NAME: - change the node's name.\r\n"); sb.append("UPDATE ask the node to self-update if possible. \r\n"); - sb.append("FILTER: \\r\\n - output the content as it returns from the content filter"); + sb.append("FILTER: \\r\\n - output the content as it returns from the content filter\r\n"); // sb.append("SUBFILE: - append all data received from subscriptions to a file, rather than sending it to stdout.\r\n"); // sb.append("SAY: - send text to the last created/pushed stream\r\n"); sb.append("STATUS - display some status information on the node including its reference and connections.\r\n"); From robert at freenetproject.org Fri Jan 4 03:43:44 2008 From: robert at freenetproject.org (robert at freenetproject.org) Date: Fri, 4 Jan 2008 03:43:44 +0000 (UTC) Subject: [freenet-cvs] r16875 - trunk/freenet/src/freenet/node/fcp Message-ID: <20080104034344.A040947A0B2@freenetproject.org> Author: robert Date: 2008-01-04 03:43:44 +0000 (Fri, 04 Jan 2008) New Revision: 16875 Modified: trunk/freenet/src/freenet/node/fcp/ClientGet.java trunk/freenet/src/freenet/node/fcp/ClientPut.java trunk/freenet/src/freenet/node/fcp/ClientRequest.java Log: always set start=true if finished==true (bug#1962), persist 'finished' for put requests (?!) Modified: trunk/freenet/src/freenet/node/fcp/ClientGet.java =================================================================== --- trunk/freenet/src/freenet/node/fcp/ClientGet.java 2008-01-04 03:18:41 UTC (rev 16874) +++ trunk/freenet/src/freenet/node/fcp/ClientGet.java 2008-01-04 03:43:44 UTC (rev 16875) @@ -308,12 +308,8 @@ client.queueClientRequestMessage(msg, 0); } - if(finished){ - if(succeeded) + if(finished && succeeded) allDataPending = new AllDataMessage(returnBucket, identifier, global, startupTime, completionTime); - else - started = true; - } } public void start() { Modified: trunk/freenet/src/freenet/node/fcp/ClientPut.java =================================================================== --- trunk/freenet/src/freenet/node/fcp/ClientPut.java 2008-01-04 03:18:41 UTC (rev 16874) +++ trunk/freenet/src/freenet/node/fcp/ClientPut.java 2008-01-04 03:43:44 UTC (rev 16875) @@ -411,6 +411,7 @@ fs.putSingle("TargetFilename", targetFilename); fs.putSingle("EarlyEncode", Boolean.toString(earlyEncode)); fs.put("BinaryBlob", binaryBlob); + fs.putSingle("Finished", Boolean.toString(finished)); return fs; } Modified: trunk/freenet/src/freenet/node/fcp/ClientRequest.java =================================================================== --- trunk/freenet/src/freenet/node/fcp/ClientRequest.java 2008-01-04 03:18:41 UTC (rev 16874) +++ trunk/freenet/src/freenet/node/fcp/ClientRequest.java 2008-01-04 03:43:44 UTC (rev 16875) @@ -107,6 +107,8 @@ final String stime = fs.get("StartupTime"); this.startupTime = stime == null ? System.currentTimeMillis() : Fields.parseLong(stime); completionTime = fs.getLong("CompletionTime", 0); + if (finished) + started=true; } /** Lost connection */ From toad at freenetproject.org Fri Jan 4 14:05:35 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Fri, 4 Jan 2008 14:05:35 +0000 (UTC) Subject: [freenet-cvs] r16876 - trunk/freenet/src/freenet/node Message-ID: <20080104140535.CA8A43A11D1@freenetproject.org> Author: toad Date: 2008-01-04 14:05:35 +0000 (Fri, 04 Jan 2008) New Revision: 16876 Modified: trunk/freenet/src/freenet/node/Node.java Log: Set maxUtilization parameter to the default, 50%. Improve performance, reduce the frequency of the Cleaner doing log garbage collection. Modified: trunk/freenet/src/freenet/node/Node.java =================================================================== --- trunk/freenet/src/freenet/node/Node.java 2008-01-04 03:43:44 UTC (rev 16875) +++ trunk/freenet/src/freenet/node/Node.java 2008-01-04 14:05:35 UTC (rev 16876) @@ -1106,7 +1106,9 @@ // Percentage of the database that must contain usefull data // decrease to increase performance, increase to save disk space - System.setProperty("je.cleaner.minUtilization","90"); + // Let it stay at the default of 50% for best performance. + // We only use it for indexes, so it won't get huge. + //System.setProperty("je.cleaner.minUtilization","90"); // Delete empty log files System.setProperty("je.cleaner.expunge","true"); EnvironmentConfig envConfig = new EnvironmentConfig(); From toad at freenetproject.org Fri Jan 4 14:58:30 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Fri, 4 Jan 2008 14:58:30 +0000 (UTC) Subject: [freenet-cvs] r16877 - trunk/freenet/src/freenet/node/fcp Message-ID: <20080104145830.2AA4C3A126A@freenetproject.org> Author: toad Date: 2008-01-04 14:58:29 +0000 (Fri, 04 Jan 2008) New Revision: 16877 Modified: trunk/freenet/src/freenet/node/fcp/ClientPut.java Log: Don't put(Finished), we already did that in super.toFieldSet(). Modified: trunk/freenet/src/freenet/node/fcp/ClientPut.java =================================================================== --- trunk/freenet/src/freenet/node/fcp/ClientPut.java 2008-01-04 14:05:35 UTC (rev 16876) +++ trunk/freenet/src/freenet/node/fcp/ClientPut.java 2008-01-04 14:58:29 UTC (rev 16877) @@ -411,7 +411,6 @@ fs.putSingle("TargetFilename", targetFilename); fs.putSingle("EarlyEncode", Boolean.toString(earlyEncode)); fs.put("BinaryBlob", binaryBlob); - fs.putSingle("Finished", Boolean.toString(finished)); return fs; } From toad at freenetproject.org Fri Jan 4 15:07:58 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Fri, 4 Jan 2008 15:07:58 +0000 (UTC) Subject: [freenet-cvs] r16878 - trunk/freenet/src/freenet/store Message-ID: <20080104150758.3979E47BBF6@freenetproject.org> Author: toad Date: 2008-01-04 15:07:57 +0000 (Fri, 04 Jan 2008) New Revision: 16878 Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java Log: BDBFS: Remember the storeType Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java =================================================================== --- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-04 14:58:29 UTC (rev 16877) +++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-04 15:07:57 UTC (rev 16878) @@ -68,6 +68,7 @@ final int dataBlockSize; final int headerBlockSize; + private final short storeType; private final Environment environment; private final TupleBinding storeBlockTupleBinding; private final File fixSecondaryFile; @@ -190,7 +191,7 @@ try { // First try just opening it. - return new BerkeleyDBFreenetStore(storeEnvironment, newDBPrefix, newStoreFile, newFixSecondaryFile, + return new BerkeleyDBFreenetStore(type, storeEnvironment, newDBPrefix, newStoreFile, newFixSecondaryFile, maxStoreKeys, blockSize, headerSize, throwOnTooFewKeys, noCheck, wipe, storeShutdownHook, reconstructFile); } catch (DatabaseException e) { @@ -204,7 +205,7 @@ System.err.println("Cannot reconstruct SSK store/cache! Sorry, your SSK store will now be deleted..."); BerkeleyDBFreenetStore.wipeOldDatabases(storeEnvironment, newDBPrefix); newStoreFile.delete(); - return new BerkeleyDBFreenetStore(storeEnvironment, newDBPrefix, newStoreFile, newFixSecondaryFile, + return new BerkeleyDBFreenetStore(type, storeEnvironment, newDBPrefix, newStoreFile, newFixSecondaryFile, maxStoreKeys, blockSize, headerSize, throwOnTooFewKeys, noCheck, wipe, storeShutdownHook, reconstructFile); } @@ -239,8 +240,9 @@ * @throws DatabaseException * @throws FileNotFoundException if the dir does not exist and could not be created */ - private BerkeleyDBFreenetStore(Environment env, String prefix, File storeFile, File fixSecondaryFile, long maxChkBlocks, int blockSize, int headerSize, boolean throwOnTooFewKeys, boolean noCheck, boolean wipe, SemiOrderedShutdownHook storeShutdownHook, File reconstructFile) throws IOException, DatabaseException { + private BerkeleyDBFreenetStore(short type, Environment env, String prefix, File storeFile, File fixSecondaryFile, long maxChkBlocks, int blockSize, int headerSize, boolean throwOnTooFewKeys, boolean noCheck, boolean wipe, SemiOrderedShutdownHook storeShutdownHook, File reconstructFile) throws IOException, DatabaseException { logMINOR = Logger.shouldLog(Logger.MINOR, this); + this.storeType = type; this.dataBlockSize = blockSize; this.headerBlockSize = headerSize; this.freeBlocks = new SortedLongSet(); @@ -959,6 +961,7 @@ */ private BerkeleyDBFreenetStore(Environment env, String prefix, File storeFile, File fixSecondaryFile, long maxChkBlocks, int blockSize, int headerSize, short type, boolean noCheck, SemiOrderedShutdownHook storeShutdownHook, File reconstructFile) throws DatabaseException, IOException { logMINOR = Logger.shouldLog(Logger.MINOR, this); + this.storeType = type; this.dataBlockSize = blockSize; this.headerBlockSize = headerSize; this.freeBlocks = new SortedLongSet(); From toad at freenetproject.org Fri Jan 4 15:10:23 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Fri, 4 Jan 2008 15:10:23 +0000 (UTC) Subject: [freenet-cvs] r16879 - trunk/freenet/src/freenet/store Message-ID: <20080104151023.26B3C47A2D7@freenetproject.org> Author: toad Date: 2008-01-04 15:10:22 +0000 (Fri, 04 Jan 2008) New Revision: 16879 Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java Log: Put in assertions to check the storeType against the access made. Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java =================================================================== --- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-04 15:07:57 UTC (rev 16878) +++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-04 15:10:22 UTC (rev 16879) @@ -1148,6 +1148,7 @@ * @return null if there is no such block stored, otherwise the block. */ public CHKBlock fetch(NodeCHK chk, boolean dontPromote) throws IOException { + assert(storeType == TYPE_CHK); synchronized(this) { if(closed) return null; @@ -1284,6 +1285,7 @@ * @return null if there is no such block stored, otherwise the block. */ public SSKBlock fetch(NodeSSK chk, boolean dontPromote) throws IOException { + assert(storeType == TYPE_SSK); synchronized(this) { if(closed) return null; @@ -1407,6 +1409,7 @@ * @return null if there is no such block stored, otherwise the block. */ public DSAPublicKey fetchPubKey(byte[] hash, DSAPublicKey replacement, boolean dontPromote) throws IOException { + assert(storeType == TYPE_PUBKEY); synchronized(this) { if(closed) return null; @@ -1565,6 +1568,7 @@ } public void put(CHKBlock b) throws IOException { + assert(storeType == TYPE_CHK); NodeCHK chk = (NodeCHK) b.getKey(); CHKBlock oldBlock = fetch(chk, false); if(oldBlock != null) @@ -1573,6 +1577,7 @@ } public void put(SSKBlock b, boolean overwrite) throws IOException, KeyCollisionException { + assert(storeType == TYPE_SSK); NodeSSK ssk = (NodeSSK) b.getKey(); SSKBlock oldBlock = fetch(ssk, false); if(oldBlock != null) { @@ -1589,6 +1594,7 @@ } private boolean overwrite(SSKBlock b) throws IOException { + assert(storeType == TYPE_SSK); synchronized(this) { if(closed) return false; @@ -1845,6 +1851,7 @@ * Store a pubkey. */ public void put(byte[] hash, DSAPublicKey key) throws IOException { + assert(storeType == TYPE_PUBKEY); innerPut(hash, key); } From toad at freenetproject.org Fri Jan 4 15:14:22 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Fri, 4 Jan 2008 15:14:22 +0000 (UTC) Subject: [freenet-cvs] r16880 - trunk/freenet/src/freenet/store Message-ID: <20080104151422.DD50C3A1284@freenetproject.org> Author: toad Date: 2008-01-04 15:14:22 +0000 (Fri, 04 Jan 2008) New Revision: 16880 Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java Log: Refactor: rename various variables, get rid of "chk" in variable names. Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java =================================================================== --- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-04 15:10:22 UTC (rev 16879) +++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-04 15:14:22 UTC (rev 16880) @@ -73,16 +73,16 @@ private final TupleBinding storeBlockTupleBinding; private final File fixSecondaryFile; - private long chkBlocksInStore = 0; - private final Object chkBlocksInStoreLock = new Object(); - private long maxChkBlocks; + private long blocksInStore = 0; + private final Object blocksInStoreLock = new Object(); + private long maxBlocksInStore; private long hits = 0; private long misses = 0; private long writes = 0; - private final Database chkDB; - private final SecondaryDatabase chkDB_accessTime; - private final SecondaryDatabase chkDB_blockNum; - private final RandomAccessFile chkStore; + private final Database keysDB; + private final SecondaryDatabase accessTimeDB; + private final SecondaryDatabase blockNumDB; + private final RandomAccessFile storeRAF; private final SortedLongSet freeBlocks; private final String name; @@ -248,7 +248,7 @@ this.freeBlocks = new SortedLongSet(); name = prefix; - this.maxChkBlocks=maxChkBlocks; + this.maxBlocksInStore=maxChkBlocks; this.reconstructFile = reconstructFile; environment = env; @@ -262,7 +262,7 @@ wipeOldDatabases(environment, prefix); } - chkDB = environment.openDatabase(null,prefix+"CHK",dbConfig); + keysDB = environment.openDatabase(null,prefix+"CHK",dbConfig); System.err.println("Opened main database for "+prefix); this.fixSecondaryFile = fixSecondaryFile; @@ -272,7 +272,7 @@ Logger.error(this, "This may take some time..."); System.err.println("Recreating secondary databases"); System.err.println("This may take some time..."); - WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE, 5*60*1000+chkDB.count()*100))); + WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE, 5*60*1000+keysDB.count()*100))); // Of course it's not a solution but a quick fix // Integer.MAX_VALUE seems to trigger an overflow or whatever ... // Either we find out what the maximum value is and we do a static method somewhere ensuring @@ -298,7 +298,7 @@ // Initialize secondary CHK database sorted on accesstime SecondaryDatabase atime = null; SecondaryConfig secDbConfig = new SecondaryConfig(); - secDbConfig.setAllowCreate(chkDB.count() == 0); + secDbConfig.setAllowCreate(keysDB.count() == 0); secDbConfig.setSortedDuplicates(true); secDbConfig.setTransactional(true); secDbConfig.setAllowPopulate(false); @@ -310,9 +310,9 @@ try { System.err.println("Opening access times database for "+prefix); atime = environment.openSecondaryDatabase - (null, prefix+"CHK_accessTime", chkDB, secDbConfig); + (null, prefix+"CHK_accessTime", keysDB, secDbConfig); // The below is too slow to be useful, because SecondaryDatabase.count() isn't optimised. -// long chkDBCount = chkDB.count(); +// long chkDBCount = keysDB.count(); // System.err.println("Counting size of access times database..."); // long atimeCount = atime.count(); // if(atimeCount < chkDBCount) { @@ -320,7 +320,7 @@ // throw new DatabaseException("Needs repopulation"); // } } catch (DatabaseException e) { - WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE, 5*60*1000L+chkDB.count()*100L))); + WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE, 5*60*1000L+keysDB.count()*100L))); // Of course it's not a solution but a quick fix // Integer.MAX_VALUE seems to trigger an overflow or whatever ... // Either we find out what the maximum value is and we do a static method somewhere ensuring @@ -337,7 +337,7 @@ secDbConfig.setAllowCreate(true); secDbConfig.setAllowPopulate(true); atime = environment.openSecondaryDatabase - (null, prefix+"CHK_accessTime", chkDB, secDbConfig); + (null, prefix+"CHK_accessTime", keysDB, secDbConfig); } } catch (DatabaseException e1) { // Log this now because close() will probably throw too @@ -347,7 +347,7 @@ close(false); throw e1; } - chkDB_accessTime = atime; + accessTimeDB = atime; System.err.println("Opened access times database for "+prefix); // Initialize other secondary database sorted on block number @@ -355,7 +355,7 @@ // environment.removeDatabase(null, "CHK_blockNum"); // } catch (DatabaseNotFoundException e) { }; SecondaryConfig blockNoDbConfig = new SecondaryConfig(); - blockNoDbConfig.setAllowCreate(chkDB.count() == 0); + blockNoDbConfig.setAllowCreate(keysDB.count() == 0); blockNoDbConfig.setSortedDuplicates(false); blockNoDbConfig.setAllowPopulate(false); blockNoDbConfig.setTransactional(true); @@ -369,16 +369,16 @@ try { System.err.println("Opening block db index"); blockNums = environment.openSecondaryDatabase - (null, blockDBName, chkDB, blockNoDbConfig); + (null, blockDBName, keysDB, blockNoDbConfig); // The below is too slow to be useful, because SecondaryDatabase.count() isn't optimised. // long blockNumsCount = blockNums.count(); -// long chkDBCount = chkDB.count(); +// long chkDBCount = keysDB.count(); // if(blockNumsCount < chkDBCount) { // System.err.println("Block nums database: "+blockNumsCount+" but main database: "+chkDBCount); // throw new DatabaseException("Needs repopulation"); // } } catch (DatabaseException e) { - WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE, 5*60*1000+chkDB.count()*100))); + WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE, 5*60*1000+keysDB.count()*100))); // Of course it's not a solution but a quick fix // Integer.MAX_VALUE seems to trigger an overflow or whatever ... // Either we find out what the maximum value is and we do a static method somewhere ensuring @@ -401,7 +401,7 @@ blockNoDbConfig.setAllowCreate(true); blockNoDbConfig.setAllowPopulate(true); blockNums = environment.openSecondaryDatabase - (null, blockDBName, chkDB, blockNoDbConfig); + (null, blockDBName, keysDB, blockNoDbConfig); } } catch (DatabaseException e1) { // Log this now because close() will probably throw too @@ -413,19 +413,19 @@ } System.err.println("Opened block number database for "+prefix); - chkDB_blockNum = blockNums; + blockNumDB = blockNums; // Initialize the store file try { if(!storeFile.exists()) if(!storeFile.createNewFile()) throw new DatabaseException("can't create a new file !"); - chkStore = new RandomAccessFile(storeFile,"rw"); + storeRAF = new RandomAccessFile(storeFile,"rw"); boolean dontCheckForHolesShrinking = false; long chkBlocksInDatabase = highestBlockNumberInDatabase(); - chkBlocksInStore = chkBlocksInDatabase; + blocksInStore = chkBlocksInDatabase; long chkBlocksFromFile = countCHKBlocksFromFile(); lastRecentlyUsed = getMaxRecentlyUsed(); @@ -439,8 +439,8 @@ // FIXME we can do a cleverer recovery: Find all keys whose block number is > chkBlocksFromFile and delete them } - if(((chkBlocksInStore == 0) && (chkBlocksFromFile != 0)) || - (((chkBlocksInStore + 10) * 1.1) < chkBlocksFromFile)) { + if(((blocksInStore == 0) && (chkBlocksFromFile != 0)) || + (((blocksInStore + 10) * 1.1) < chkBlocksFromFile)) { if(throwOnTooFewKeys) { try { close(false); @@ -449,25 +449,25 @@ System.err.println("Failed to close: "+t); t.printStackTrace(); } - throw new DatabaseException("Keys in database: "+chkBlocksInStore+" but keys in file: "+chkBlocksFromFile); + throw new DatabaseException("Keys in database: "+blocksInStore+" but keys in file: "+chkBlocksFromFile); } else if(!noCheck) { long len = checkForHoles(chkBlocksFromFile, true); dontCheckForHolesShrinking = true; if(len < chkBlocksFromFile) { System.err.println("Truncating to "+len+" from "+chkBlocksFromFile+" as no non-holes after that point"); - chkStore.setLength(len * (dataBlockSize + headerBlockSize)); - chkBlocksInStore = len; + storeRAF.setLength(len * (dataBlockSize + headerBlockSize)); + blocksInStore = len; } } } - chkBlocksInStore = Math.max(chkBlocksInStore, chkBlocksFromFile); - if(logMINOR) Logger.minor(this, "Keys in store: "+chkBlocksInStore); + blocksInStore = Math.max(blocksInStore, chkBlocksFromFile); + if(logMINOR) Logger.minor(this, "Keys in store: "+blocksInStore); if(!noCheck) { maybeOfflineShrink(dontCheckForHolesShrinking); chkBlocksFromFile = countCHKBlocksFromFile(); - chkBlocksInStore = Math.max(chkBlocksInStore, chkBlocksFromFile); + blocksInStore = Math.max(blocksInStore, chkBlocksFromFile); } // Add shutdownhook @@ -497,7 +497,7 @@ LongBinding.longToEntry(i, blockNumEntry); OperationStatus success = - chkDB_blockNum.get(null, blockNumEntry, found, LockMode.DEFAULT); + blockNumDB.get(null, blockNumEntry, found, LockMode.DEFAULT); if(success.equals(OperationStatus.NOTFOUND)) { addFreeBlock(i, true, "hole found"); @@ -510,12 +510,12 @@ System.err.println("Checked database of "+blocksInFile+" blocks, found "+holes+" holes, maximum non-hole block: "+maxPresent); long bound = maxPresent+1; if(!dontTruncate) { - if(bound < chkBlocksInStore) { + if(bound < blocksInStore) { System.err.println("Truncating to "+bound+" as no non-holes after that point"); try { - chkStore.setLength(bound * (dataBlockSize + headerBlockSize)); - chkBlocksInStore = bound; - for(long l=bound;l maxChkBlocks || forceBigOnlineShrinks) { - Logger.error(this, "Doing quick and dirty shrink of the store by "+(100 * (chkBlocksInStore - maxChkBlocks) / chkBlocksInStore)+"%"); + if(blocksInStore * 0.9 > maxBlocksInStore || forceBigOnlineShrinks) { + Logger.error(this, "Doing quick and dirty shrink of the store by "+(100 * (blocksInStore - maxBlocksInStore) / blocksInStore)+"%"); Logger.error(this, "Offline shrinks will preserve the most recently used data, this online shrink does not."); Runnable r = new Runnable() { public void run() { @@ -589,22 +589,22 @@ Cursor c = null; Transaction t = null; - long newSize = maxChkBlocks; - if(chkBlocksInStore < maxChkBlocks) return; + long newSize = maxBlocksInStore; + if(blocksInStore < maxBlocksInStore) return; - System.err.println("Shrinking from "+chkBlocksInStore+" to "+maxChkBlocks+" (from db "+chkDB.count()+" from file "+countCHKBlocksFromFile()+ ')'); + System.err.println("Shrinking from "+blocksInStore+" to "+maxBlocksInStore+" (from db "+keysDB.count()+" from file "+countCHKBlocksFromFile()+ ')'); if(!dontCheckForHoles) - checkForHoles(maxChkBlocks, true); + checkForHoles(maxBlocksInStore, true); - WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE, 5*60*1000 + chkBlocksInStore * 100))); // 10 per second + WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE, 5*60*1000 + blocksInStore * 100))); // 10 per second long realSize = countCHKBlocksFromFile(); long highestBlock = 0; try { - c = chkDB_accessTime.openCursor(null,null); + c = accessTimeDB.openCursor(null,null); DatabaseEntry keyDBE = new DatabaseEntry(); DatabaseEntry blockDBE = new DatabaseEntry(); @@ -722,7 +722,7 @@ int unwantedBlock = ((Integer) alreadyDropped.get(i)).intValue(); DatabaseEntry unwantedBlockEntry = new DatabaseEntry(); LongBinding.longToEntry(unwantedBlock, unwantedBlockEntry); - chkDB_blockNum.delete(t, unwantedBlockEntry); + blockNumDB.delete(t, unwantedBlockEntry); if(i % 1024 == 0) { t.commit(); t = environment.beginTransaction(null,null); @@ -748,7 +748,7 @@ DatabaseEntry unwantedBlockEntry = new DatabaseEntry(); LongBinding.longToEntry(unwantedBlock.longValue(), unwantedBlockEntry); // Delete the old block from the database. - chkDB_blockNum.delete(t, unwantedBlockEntry); + blockNumDB.delete(t, unwantedBlockEntry); } else { System.err.println("Keys to move but no keys to move over! Moved "+i); t.commit(); @@ -761,8 +761,8 @@ LongBinding.longToEntry(wantedBlock.longValue(), wantedBlockEntry); long seekTo = wantedBlock.longValue() * (headerBlockSize + dataBlockSize); try { - chkStore.seek(seekTo); - chkStore.readFully(buf); + storeRAF.seek(seekTo); + storeRAF.readFully(buf); } catch (EOFException e) { System.err.println("Was reading "+wantedBlock+" to write to "+unwantedBlock); System.err.println(e); @@ -770,18 +770,18 @@ throw e; } seekTo = unwantedBlock.longValue() * (headerBlockSize + dataBlockSize); - chkStore.seek(seekTo); - chkStore.write(buf); + storeRAF.seek(seekTo); + storeRAF.write(buf); // Update the database w.r.t. the old block. DatabaseEntry routingKeyDBE = new DatabaseEntry(); DatabaseEntry blockDBE = new DatabaseEntry(); - chkDB_blockNum.get(t, wantedBlockEntry, routingKeyDBE, blockDBE, LockMode.RMW); + blockNumDB.get(t, wantedBlockEntry, routingKeyDBE, blockDBE, LockMode.RMW); StoreBlock block = (StoreBlock) storeBlockTupleBinding.entryToObject(blockDBE); block.offset = unwantedBlock.longValue(); storeBlockTupleBinding.objectToEntry(block, blockDBE); - chkDB.put(t, routingKeyDBE, blockDBE); + keysDB.put(t, routingKeyDBE, blockDBE); // Think about committing the transaction. @@ -821,7 +821,7 @@ } DatabaseEntry unwantedBlockEntry = new DatabaseEntry(); LongBinding.longToEntry(blockNo, unwantedBlockEntry); - chkDB_blockNum.delete(t, unwantedBlockEntry); + blockNumDB.delete(t, unwantedBlockEntry); if(i % 1024 == 0) { System.out.println("Trimmed surplus keys in database: "+(i-wantedMoveNums.length)+"/"+(totalUnwantedBlocks-wantedMoveNums.length)); t.commit(); @@ -837,12 +837,12 @@ System.out.println("Finishing shrink"); // FIXME remove - chkStore.setLength(newSize * (dataBlockSize + headerBlockSize)); + storeRAF.setLength(newSize * (dataBlockSize + headerBlockSize)); synchronized(this) { - chkBlocksInStore = newSize; + blocksInStore = newSize; } - System.err.println("Shrunk store, now have "+chkBlocksInStore+" of "+maxChkBlocks); + System.err.println("Shrunk store, now have "+blocksInStore+" of "+maxBlocksInStore); } /** @@ -856,8 +856,8 @@ long maxBlocks; long curBlocks; synchronized(this) { - maxBlocks = maxChkBlocks; - curBlocks = chkBlocksInStore; + maxBlocks = maxBlocksInStore; + curBlocks = blocksInStore; if(maxBlocks >= curBlocks) { System.out.println("Not shrinking store: "+curBlocks+" < "+maxBlocks); return; @@ -885,7 +885,7 @@ } Transaction t = null; try { - String msg = "Shrinking store: "+curBlocks+" -> "+maxBlocks+" (from db "+chkDB.count()+", highest "+highestBlockNumberInDatabase()+", from file "+countCHKBlocksFromFile()+ ')'; + String msg = "Shrinking store: "+curBlocks+" -> "+maxBlocks+" (from db "+keysDB.count()+", highest "+highestBlockNumberInDatabase()+", from file "+countCHKBlocksFromFile()+ ')'; System.err.println(msg); Logger.normal(this, msg); WrapperManager.signalStarting((int)Math.min(Integer.MAX_VALUE, (5*60*1000 + 100 * (Math.max(0, curBlocks-maxBlocks))))); while(true) { @@ -902,7 +902,7 @@ LongBinding.longToEntry(i, blockNumEntry); OperationStatus result = - chkDB_blockNum.delete(t, blockNumEntry); + blockNumDB.delete(t, blockNumEntry); if(result.equals(OperationStatus.SUCCESS)) deleted++; @@ -914,8 +914,8 @@ freeBlocks.remove(i); synchronized(this) { - maxBlocks = maxChkBlocks; - curBlocks = chkBlocksInStore; + maxBlocks = maxBlocksInStore; + curBlocks = blocksInStore; if(maxBlocks >= curBlocks) break; } @@ -931,16 +931,16 @@ if(offline) break; System.err.println("Checking..."); synchronized(this) { - maxBlocks = maxChkBlocks; - curBlocks = chkBlocksInStore; + maxBlocks = maxBlocksInStore; + curBlocks = blocksInStore; if(maxBlocks >= curBlocks) break; } } - chkStore.setLength(maxChkBlocks * (dataBlockSize + headerBlockSize)); + storeRAF.setLength(maxBlocksInStore * (dataBlockSize + headerBlockSize)); - chkBlocksInStore = maxChkBlocks; - System.err.println("Successfully shrunk store to "+chkBlocksInStore); + blocksInStore = maxBlocksInStore; + System.err.println("Successfully shrunk store to "+blocksInStore); } finally { if(t != null) t.abort(); @@ -965,7 +965,7 @@ this.dataBlockSize = blockSize; this.headerBlockSize = headerSize; this.freeBlocks = new SortedLongSet(); - this.maxChkBlocks=maxChkBlocks; + this.maxBlocksInStore=maxChkBlocks; this.environment = env; this.reconstructFile = reconstructFile; name = prefix; @@ -979,10 +979,10 @@ dbConfig.setAllowCreate(true); dbConfig.setTransactional(true); - chkDB = environment.openDatabase(null,prefix+"CHK",dbConfig); + keysDB = environment.openDatabase(null,prefix+"CHK",dbConfig); - if(chkDB.count() > 0) - throw new IllegalStateException("Wiped old store but it still contains "+chkDB.count()+" keys!"); + if(keysDB.count() > 0) + throw new IllegalStateException("Wiped old store but it still contains "+keysDB.count()+" keys!"); this.fixSecondaryFile = fixSecondaryFile; fixSecondaryFile.delete(); @@ -997,8 +997,8 @@ AccessTimeKeyCreator accessTimeKeyCreator = new AccessTimeKeyCreator(storeBlockTupleBinding); secDbConfig.setKeyCreator(accessTimeKeyCreator); - chkDB_accessTime = environment.openSecondaryDatabase - (null, prefix+"CHK_accessTime", chkDB, secDbConfig); + accessTimeDB = environment.openSecondaryDatabase + (null, prefix+"CHK_accessTime", keysDB, secDbConfig); // Initialize other secondary database sorted on block number SecondaryConfig blockNoDbConfig = new SecondaryConfig(); @@ -1011,22 +1011,22 @@ new BlockNumberKeyCreator(storeBlockTupleBinding); blockNoDbConfig.setKeyCreator(bnkc); System.err.println("Creating block db index"); - chkDB_blockNum = environment.openSecondaryDatabase - (null, prefix+"CHK_blockNum", chkDB, blockNoDbConfig); + blockNumDB = environment.openSecondaryDatabase + (null, prefix+"CHK_blockNum", keysDB, blockNoDbConfig); // Initialize the store file if(!storeFile.exists()) if(!storeFile.createNewFile()) throw new DatabaseException("can't create a new file !"); - chkStore = new RandomAccessFile(storeFile,"rw"); + storeRAF = new RandomAccessFile(storeFile,"rw"); - chkBlocksInStore = 0; + blocksInStore = 0; lastRecentlyUsed = 0; reconstruct(type); - chkBlocksInStore = countCHKBlocksFromFile(); + blocksInStore = countCHKBlocksFromFile(); lastRecentlyUsed = getMaxRecentlyUsed(); if(!noCheck) { @@ -1059,7 +1059,7 @@ } private void reconstruct(short type) throws DatabaseException, IOException { - if(chkDB.count() != 0) + if(keysDB.count() != 0) throw new IllegalStateException("Store must be empty before reconstruction!"); if(type == TYPE_SSK) { System.err.println("Reconstruction of SSK store not supported at present."); @@ -1069,18 +1069,18 @@ } System.err.println("Reconstructing store index from store file: type="+type); Logger.error(this, "Reconstructing store index from store file: type="+type); - WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE, 5*60*1000+(chkStore.length()/(dataBlockSize+headerBlockSize))*100))); + WrapperManager.signalStarting((int)(Math.min(Integer.MAX_VALUE, 5*60*1000+(storeRAF.length()/(dataBlockSize+headerBlockSize))*100))); byte[] header = new byte[headerBlockSize]; byte[] data = new byte[dataBlockSize]; long l = 0; long dupes = 0; long failures = 0; try { - chkStore.seek(0); + storeRAF.seek(0); for(l=0;true;l++) { Transaction t = null; - chkStore.readFully(header); - chkStore.readFully(data); + storeRAF.readFully(header); + storeRAF.readFully(data); try { byte[] routingkey = null; if(type == TYPE_CHK) { @@ -1107,7 +1107,7 @@ DatabaseEntry routingkeyDBE = new DatabaseEntry(routingkey); DatabaseEntry blockDBE = new DatabaseEntry(); storeBlockTupleBinding.objectToEntry(storeBlock, blockDBE); - OperationStatus op = chkDB.putNoOverwrite(t,routingkeyDBE,blockDBE); + OperationStatus op = keysDB.putNoOverwrite(t,routingkeyDBE,blockDBE); if(op == OperationStatus.KEYEXIST) { addFreeBlock(l, true, "duplicate"); dupes++; @@ -1117,7 +1117,7 @@ } t.commit(); if(l % 1024 == 0) - System.out.println("Key "+l+ '/' +(chkStore.length()/(dataBlockSize+headerBlockSize))+" OK ("+dupes+" dupes, "+failures+" failures)"); + System.out.println("Key "+l+ '/' +(storeRAF.length()/(dataBlockSize+headerBlockSize))+" OK ("+dupes+" dupes, "+failures+" failures)"); t = null; } catch (CryptFormatException e) { addFreeBlock(l, true, "invalid key: "+e); @@ -1133,9 +1133,9 @@ } catch (EOFException e) { long size = l * (dataBlockSize + headerBlockSize); System.err.println("Found end of store, truncating to "+l+" blocks : "+size); - chkBlocksInStore = l; + blocksInStore = l; try { - chkStore.setLength(size); + storeRAF.setLength(size); } catch (IOException e1) { System.err.println("Failed to set size"); } @@ -1161,7 +1161,7 @@ Transaction t = null; try { t = environment.beginTransaction(null,null); - c = chkDB.openCursor(t,null); + c = keysDB.openCursor(t,null); if(logMINOR) Logger.minor(this, "Fetching "+chk+" dontPromote="+dontPromote); /** @@ -1191,27 +1191,27 @@ byte[] header = new byte[headerBlockSize]; byte[] data = new byte[dataBlockSize]; try { - synchronized(chkStore) { + synchronized(storeRAF) { if(logMINOR) Logger.minor(this, "Reading data from store..."); long seekTarget = storeBlock.offset*(long)(dataBlockSize+headerBlockSize); try { - chkStore.seek(seekTarget); + storeRAF.seek(seekTarget); } catch (IOException ioe) { if(seekTarget > (2l*1024*1024*1024)) { Logger.error(this, "Environment does not support files bigger than 2 GB?"); System.out.println("Environment does not support files bigger than 2 GB? (exception to follow)"); } - Logger.error(this, "Caught IOException on chkStore.seek("+seekTarget+ ')'); + Logger.error(this, "Caught IOException on storeRAF.seek("+seekTarget+ ')'); throw ioe; } - chkStore.readFully(header); - chkStore.readFully(data); + storeRAF.readFully(header); + storeRAF.readFully(data); } } catch (EOFException e) { Logger.error(this, "No block"); c.close(); c = null; - chkDB.delete(t, routingkeyDBE); + keysDB.delete(t, routingkeyDBE); t.commit(); t = null; addFreeBlock(storeBlock.offset, true, "Data off end of store file"); @@ -1249,7 +1249,7 @@ System.err.println("Does not verify (CHK block "+storeBlock.offset+ ')'); c.close(); c = null; - chkDB.delete(t, routingkeyDBE); + keysDB.delete(t, routingkeyDBE); t.commit(); t = null; addFreeBlock(storeBlock.offset, true, "CHK does not verify"); @@ -1298,7 +1298,7 @@ Transaction t = null; try { t = environment.beginTransaction(null,null); - c = chkDB.openCursor(t,null); + c = keysDB.openCursor(t,null); // Explanation of locking is in fetchPubKey. // Basically, locking the whole element saves us all sorts of trouble, especially @@ -1323,16 +1323,16 @@ byte[] header = new byte[headerBlockSize]; byte[] data = new byte[dataBlockSize]; try { - synchronized(chkStore) { - chkStore.seek(storeBlock.offset*(long)(dataBlockSize+headerBlockSize)); - chkStore.readFully(header); - chkStore.readFully(data); + synchronized(storeRAF) { + storeRAF.seek(storeBlock.offset*(long)(dataBlockSize+headerBlockSize)); + storeRAF.readFully(header); + storeRAF.readFully(data); } } catch (EOFException e) { Logger.error(this, "No block"); c.close(); c = null; - chkDB.delete(t, routingkeyDBE); + keysDB.delete(t, routingkeyDBE); t.commit(); t = null; addFreeBlock(storeBlock.offset, true, "Data off end of store file"); @@ -1365,7 +1365,7 @@ } catch(SSKVerifyException ex) { Logger.normal(this, "SSKBlock: Does not verify ("+ex+"), setting accessTime to 0 for : "+chk, ex); - chkDB.delete(t, routingkeyDBE); + keysDB.delete(t, routingkeyDBE); c.close(); c = null; t.commit(); @@ -1422,7 +1422,7 @@ try { if(logMINOR) Logger.minor(this, "Fetching pubkey: "+HexUtil.bytesToHex(hash)); t = environment.beginTransaction(null,null); - c = chkDB.openCursor(t,null); + c = keysDB.openCursor(t,null); // Lock the records as soon as we find them. // RMW - nobody else may access this key until we are finished. @@ -1459,15 +1459,15 @@ if(logMINOR) Logger.minor(this, "Reading from store... "+storeBlock.offset+" ("+storeBlock.recentlyUsed+ ')'); // When will java have pread/pwrite? :( try { - synchronized(chkStore) { - chkStore.seek(storeBlock.offset*(long)(dataBlockSize+headerBlockSize)); - chkStore.readFully(data); + synchronized(storeRAF) { + storeRAF.seek(storeBlock.offset*(long)(dataBlockSize+headerBlockSize)); + storeRAF.readFully(data); } } catch (EOFException e) { Logger.error(this, "No block"); c.close(); c = null; - chkDB.delete(t, routingkeyDBE); + keysDB.delete(t, routingkeyDBE); t.commit(); t = null; addFreeBlock(storeBlock.offset, true, "Data off end of store file"); @@ -1531,10 +1531,10 @@ private boolean finishKey(StoreBlock storeBlock, Cursor c, Transaction t, DatabaseEntry routingkeyDBE, byte[] hash, DSAPublicKey replacement) throws IOException, DatabaseException { if(replacement != null) { Logger.normal(this, "Replacing corrupt DSAPublicKey ("+HexUtil.bytesToHex(hash)); - synchronized(chkStore) { - chkStore.seek(storeBlock.offset*(long)(dataBlockSize+headerBlockSize)); + synchronized(storeRAF) { + storeRAF.seek(storeBlock.offset*(long)(dataBlockSize+headerBlockSize)); byte[] toWrite = replacement.asPaddedBytes(); - chkStore.write(toWrite); + storeRAF.write(toWrite); } c.close(); t.commit(); @@ -1543,7 +1543,7 @@ Logger.error(this, "DSAPublicKey: Does not verify (unequal hashes), setting accessTime to 0 for : "+HexUtil.bytesToHex(hash)); c.close(); c = null; - chkDB.delete(t, routingkeyDBE); + keysDB.delete(t, routingkeyDBE); t.commit(); t = null; addFreeBlock(storeBlock.offset, true, "pubkey does not verify"); @@ -1608,7 +1608,7 @@ Transaction t = null; try { t = environment.beginTransaction(null,null); - c = chkDB.openCursor(t,null); + c = keysDB.openCursor(t,null); // Lock the record. if(c.getSearchKey(routingkeyDBE,blockDBE,LockMode.RMW) @@ -1624,10 +1624,10 @@ byte[] header = b.getRawHeaders(); byte[] data = b.getRawData(); - synchronized(chkStore) { - chkStore.seek(storeBlock.offset*(long)(dataBlockSize+headerBlockSize)); - chkStore.write(header); - chkStore.write(data); + synchronized(storeRAF) { + storeRAF.seek(storeBlock.offset*(long)(dataBlockSize+headerBlockSize)); + storeRAF.write(header); + storeRAF.write(data); } // Unlock record. @@ -1688,7 +1688,7 @@ // Check whether it already exists if(logMINOR) Logger.minor(this, "Putting key "+block+" - checking whether it exists first"); - OperationStatus result = chkDB.get(t, routingkeyDBE, blockDBE, LockMode.RMW); + OperationStatus result = keysDB.get(t, routingkeyDBE, blockDBE, LockMode.RMW); if(result == OperationStatus.SUCCESS || result == OperationStatus.KEYEXIST) { if(logMINOR) Logger.minor(this, "Key already exists"); @@ -1739,7 +1739,7 @@ private void overwriteLRUBlock(byte[] header, byte[] data, Transaction t, DatabaseEntry routingkeyDBE) throws DatabaseException, IOException { // Overwrite an other block - Cursor c = chkDB_accessTime.openCursor(t,null); + Cursor c = accessTimeDB.openCursor(t,null); DatabaseEntry keyDBE = new DatabaseEntry(); DatabaseEntry dataDBE = new DatabaseEntry(); c.getFirst(keyDBE,dataDBE,LockMode.RMW); @@ -1751,11 +1751,11 @@ StoreBlock storeBlock = new StoreBlock(this, oldStoreBlock.getOffset()); DatabaseEntry blockDBE = new DatabaseEntry(); storeBlockTupleBinding.objectToEntry(storeBlock, blockDBE); - chkDB.put(t,routingkeyDBE,blockDBE); - synchronized(chkStore) { - chkStore.seek(storeBlock.getOffset()*(long)(dataBlockSize+headerBlockSize)); - chkStore.write(header); - chkStore.write(data); + keysDB.put(t,routingkeyDBE,blockDBE); + synchronized(storeRAF) { + storeRAF.seek(storeBlock.getOffset()*(long)(dataBlockSize+headerBlockSize)); + storeRAF.write(header); + storeRAF.write(data); writes++; } } @@ -1766,14 +1766,14 @@ DatabaseEntry blockDBE = new DatabaseEntry(); storeBlockTupleBinding.objectToEntry(storeBlock, blockDBE); try { - chkDB.put(t,routingkeyDBE,blockDBE); + keysDB.put(t,routingkeyDBE,blockDBE); } catch (DatabaseException e) { DatabaseEntry blockNumEntry = new DatabaseEntry(); DatabaseEntry found = new DatabaseEntry(); LongBinding.longToEntry(blockNum, blockNumEntry); OperationStatus success = - chkDB_blockNum.get(t, blockNumEntry, found, LockMode.DEFAULT); + blockNumDB.get(t, blockNumEntry, found, LockMode.DEFAULT); if(success == OperationStatus.KEYEXIST || success == OperationStatus.SUCCESS) { System.err.println("Trying to overwrite block "+blockNum+" but already used: "+getName()+" for "+e); @@ -1785,19 +1785,19 @@ throw e; } } - synchronized(chkStore) { + synchronized(storeRAF) { try { - chkStore.seek(byteOffset); + storeRAF.seek(byteOffset); } catch (IOException ioe) { if(byteOffset > (2l*1024*1024*1024)) { Logger.error(this, "Environment does not support files bigger than 2 GB?"); System.out.println("Environment does not support files bigger than 2 GB? (exception to follow)"); } - Logger.error(this, "Caught IOException on chkStore.seek("+byteOffset+ ')'); + Logger.error(this, "Caught IOException on storeRAF.seek("+byteOffset+ ')'); throw ioe; } - chkStore.write(header); - chkStore.write(data); + storeRAF.write(header); + storeRAF.write(data); writes++; } return true; @@ -1886,7 +1886,7 @@ // Check whether it already exists if(logMINOR) Logger.minor(this, "Putting key: "+HexUtil.bytesToHex(hash)+" : "+key+" - checking whether it exists already..."); - OperationStatus result = chkDB.get(t, routingkeyDBE, blockDBE, LockMode.RMW); + OperationStatus result = keysDB.get(t, routingkeyDBE, blockDBE, LockMode.RMW); if(result == OperationStatus.SUCCESS || result == OperationStatus.KEYEXIST) { // Key already exists! @@ -1945,11 +1945,11 @@ Logger.minor(this, "Overwriting free block: "+blockNum); if(writeNewBlock(blockNum, header, data, t, routingkeyDBE)) return; - } else if(chkBlocksInStore Author: toad Date: 2008-01-04 15:24:40 +0000 (Fri, 04 Jan 2008) New Revision: 16881 Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java Log: Create LRU and keys file for each store. Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java =================================================================== --- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-04 15:14:22 UTC (rev 16880) +++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-04 15:24:40 UTC (rev 16881) @@ -83,6 +83,8 @@ private final SecondaryDatabase accessTimeDB; private final SecondaryDatabase blockNumDB; private final RandomAccessFile storeRAF; + private final RandomAccessFile keysRAF; + private final RandomAccessFile lruRAF; private final SortedLongSet freeBlocks; private final String name; @@ -128,6 +130,8 @@ // Location of new store file String newStoreFileName = typeName(type) + suffix + '.' + (isStore ? "store" : "cache"); File newStoreFile = new File(baseStoreDir, newStoreFileName); + File lruFile = new File(baseStoreDir, newStoreFileName+".lru"); + File keysFile = new File(baseStoreDir, newStoreFileName+".keys"); String newDBPrefix = typeName(type)+ '-' +(isStore ? "store" : "cache")+ '-'; @@ -142,7 +146,7 @@ // Try to load new database, reconstruct it if necessary. // Don't need to create a new Environment, since we can use the old one. - tmp = openStore(storeEnvironment, baseStoreDir, newDBPrefix, newStoreFile, newFixSecondaryFile, maxStoreKeys, + tmp = openStore(storeEnvironment, baseStoreDir, newDBPrefix, newStoreFile, lruFile, keysFile, newFixSecondaryFile, maxStoreKeys, blockSize, headerSize, throwOnTooFewKeys, false, lastVersion, type, false, storeShutdownHook, tryDbLoad, reconstructFile); } else { @@ -150,7 +154,7 @@ // No new store file, no new database. // Start from scratch, with new store. - tmp = openStore(storeEnvironment, baseStoreDir, newDBPrefix, newStoreFile, newFixSecondaryFile, + tmp = openStore(storeEnvironment, baseStoreDir, newDBPrefix, newStoreFile, lruFile, keysFile, newFixSecondaryFile, maxStoreKeys, blockSize, headerSize, throwOnTooFewKeys, false, lastVersion, type, false, storeShutdownHook, tryDbLoad, reconstructFile); @@ -160,7 +164,7 @@ } private static BerkeleyDBFreenetStore openStore(Environment storeEnvironment, File baseDir, String newDBPrefix, File newStoreFile, - File newFixSecondaryFile, long maxStoreKeys, int blockSize, int headerSize, boolean throwOnTooFewKeys, + File lruFile, File keysFile, File newFixSecondaryFile, long maxStoreKeys, int blockSize, int headerSize, boolean throwOnTooFewKeys, boolean noCheck, int lastVersion, short type, boolean wipe, SemiOrderedShutdownHook storeShutdownHook, boolean tryDbLoad, File reconstructFile) throws DatabaseException, IOException { @@ -191,7 +195,7 @@ try { // First try just opening it. - return new BerkeleyDBFreenetStore(type, storeEnvironment, newDBPrefix, newStoreFile, newFixSecondaryFile, + return new BerkeleyDBFreenetStore(type, storeEnvironment, newDBPrefix, newStoreFile, lruFile, keysFile, newFixSecondaryFile, maxStoreKeys, blockSize, headerSize, throwOnTooFewKeys, noCheck, wipe, storeShutdownHook, reconstructFile); } catch (DatabaseException e) { @@ -205,7 +209,7 @@ System.err.println("Cannot reconstruct SSK store/cache! Sorry, your SSK store will now be deleted..."); BerkeleyDBFreenetStore.wipeOldDatabases(storeEnvironment, newDBPrefix); newStoreFile.delete(); - return new BerkeleyDBFreenetStore(type, storeEnvironment, newDBPrefix, newStoreFile, newFixSecondaryFile, + return new BerkeleyDBFreenetStore(type, storeEnvironment, newDBPrefix, newStoreFile, lruFile, keysFile, newFixSecondaryFile, maxStoreKeys, blockSize, headerSize, throwOnTooFewKeys, noCheck, wipe, storeShutdownHook, reconstructFile); } @@ -215,7 +219,7 @@ // Reconstruct - return new BerkeleyDBFreenetStore(storeEnvironment, newDBPrefix, newStoreFile, newFixSecondaryFile, + return new BerkeleyDBFreenetStore(storeEnvironment, newDBPrefix, newStoreFile, lruFile, keysFile, newFixSecondaryFile, maxStoreKeys, blockSize, headerSize, type, noCheck, storeShutdownHook, reconstructFile); } } @@ -240,7 +244,7 @@ * @throws DatabaseException * @throws FileNotFoundException if the dir does not exist and could not be created */ - private BerkeleyDBFreenetStore(short type, Environment env, String prefix, File storeFile, File fixSecondaryFile, long maxChkBlocks, int blockSize, int headerSize, boolean throwOnTooFewKeys, boolean noCheck, boolean wipe, SemiOrderedShutdownHook storeShutdownHook, File reconstructFile) throws IOException, DatabaseException { + private BerkeleyDBFreenetStore(short type, Environment env, String prefix, File storeFile, File lruFile, File keysFile, File fixSecondaryFile, long maxChkBlocks, int blockSize, int headerSize, boolean throwOnTooFewKeys, boolean noCheck, boolean wipe, SemiOrderedShutdownHook storeShutdownHook, File reconstructFile) throws IOException, DatabaseException { logMINOR = Logger.shouldLog(Logger.MINOR, this); this.storeType = type; this.dataBlockSize = blockSize; @@ -419,9 +423,19 @@ try { if(!storeFile.exists()) if(!storeFile.createNewFile()) - throw new DatabaseException("can't create a new file !"); + throw new DatabaseException("can't create a new file "+storeFile+" !"); storeRAF = new RandomAccessFile(storeFile,"rw"); + if(!lruFile.exists()) + if(!lruFile.createNewFile()) + throw new DatabaseException("can't create a new file "+lruFile+" !"); + lruRAF = new RandomAccessFile(lruFile,"rw"); + + if(!keysFile.exists()) + if(!keysFile.createNewFile()) + throw new DatabaseException("can't create a new file "+keysFile+" !"); + keysRAF = new RandomAccessFile(lruFile,"rw"); + boolean dontCheckForHolesShrinking = false; long chkBlocksInDatabase = highestBlockNumberInDatabase(); @@ -959,7 +973,7 @@ * @throws IOException If the store cannot be opened because of a filesystem problem. * @throws FileNotFoundException if the dir does not exist and could not be created */ - private BerkeleyDBFreenetStore(Environment env, String prefix, File storeFile, File fixSecondaryFile, long maxChkBlocks, int blockSize, int headerSize, short type, boolean noCheck, SemiOrderedShutdownHook storeShutdownHook, File reconstructFile) throws DatabaseException, IOException { + private BerkeleyDBFreenetStore(Environment env, String prefix, File storeFile, File lruFile, File keysFile, File fixSecondaryFile, long maxChkBlocks, int blockSize, int headerSize, short type, boolean noCheck, SemiOrderedShutdownHook storeShutdownHook, File reconstructFile) throws DatabaseException, IOException { logMINOR = Logger.shouldLog(Logger.MINOR, this); this.storeType = type; this.dataBlockSize = blockSize; @@ -1017,9 +1031,19 @@ // Initialize the store file if(!storeFile.exists()) if(!storeFile.createNewFile()) - throw new DatabaseException("can't create a new file !"); + throw new DatabaseException("can't create a new file "+storeFile+" !"); storeRAF = new RandomAccessFile(storeFile,"rw"); + if(!lruFile.exists()) + if(!lruFile.createNewFile()) + throw new DatabaseException("can't create a new file "+lruFile+" !"); + lruRAF = new RandomAccessFile(lruFile,"rw"); + + if(!keysFile.exists()) + if(!keysFile.createNewFile()) + throw new DatabaseException("can't create a new file "+keysFile+" !"); + keysRAF = new RandomAccessFile(lruFile,"rw"); + blocksInStore = 0; lastRecentlyUsed = 0; From toad at freenetproject.org Fri Jan 4 15:26:38 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Fri, 4 Jan 2008 15:26:38 +0000 (UTC) Subject: [freenet-cvs] r16882 - trunk/freenet/src/freenet/store Message-ID: <20080104152638.10C0E390864@freenetproject.org> Author: toad Date: 2008-01-04 15:26:37 +0000 (Fri, 04 Jan 2008) New Revision: 16882 Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java Log: Only create keysFile for SSK stores. Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java =================================================================== --- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-04 15:24:40 UTC (rev 16881) +++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-01-04 15:26:37 UTC (rev 16882) @@ -131,7 +131,9 @@ String newStoreFileName = typeName(type) + suffix + '.' + (isStore ? "store" : "cache"); File newStoreFile = new File(baseStoreDir, newStoreFileName); File lruFile = new File(baseStoreDir, newStoreFileName+".lru"); - File keysFile = new File(baseStoreDir, newStoreFileName+".keys"); + File keysFile = null; + if(type == TYPE_SSK) + keysFile = new File(baseStoreDir, newStoreFileName+".keys"); String newDBPrefix = typeName(type)+ '-' +(isStore ? "store" : "cache")+ '-'; @@ -431,10 +433,12 @@ throw new DatabaseException("can't create a new file "+lruFile+" !"); lruRAF = new RandomAccessFile(lruFile,"rw"); - if(!keysFile.exists()) - if(!keysFile.createNewFile()) - throw new DatabaseException("can't create a new file "+keysFile+" !"); - keysRAF = new RandomAccessFile(lruFile,"rw"); + if(keysFile != null) { + if(!keysFile.exists()) + if(!keysFile.createNewFile()) + throw new DatabaseException("can't create a new file "+keysFile+" !"); + keysRAF = new RandomAccessFile(lruFile,"rw"); + } else keysRAF = null; boolean dontCheckForHolesShrinking = false; @@ -1039,10 +1043,13 @@ throw new DatabaseException("can't create a new file "+lruFile+" !"); lruRAF = new RandomAccessFile(lruFile,"rw"); - if(!keysFile.exists()) - if(!keysFile.createNewFile()) - throw new DatabaseException("can't create a new file "+keysFile+" !"); - keysRAF = new RandomAccessFile(lruFile,"rw"); + if(keysFile != null) { + if(!keysFile.exists()) + if(!keysFile.createNewFile()) + throw new DatabaseException("can't create a new file "+keysFile+" !"); + keysRAF = new RandomAccessFile(lruFile,"rw"); + } else + keysRAF = null; blocksInStore = 0; From toad at freenetproject.org Fri Jan 4 15:32:40 2008 From: toad at freenetproject.org (toad at freenetproject.org) Date: Fri, 4 Jan 2008 15:32:40 +0000 (UTC) Subject: [freenet-cvs] r16883 - trunk/freenet/src/freenet/store Message-ID: <20080104153240.A5C2639086F@freenetproject.org> Author: toad Date: 2008-01-04