diff options
author | Julius Bünger <buenger@mytum.de> | 2016-07-01 23:38:35 +0000 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2016-07-01 23:38:35 +0000 |
commit | fd921d12bd321648bb44358ec87ddf488f4e5a34 (patch) | |
tree | 3403b44405c4c3ea8604532a880e8d3dd75bda55 /src | |
parent | c3c14c805a5994537391dd9e41c252cfcd9fb524 (diff) | |
download | gnunet-fd921d12bd321648bb44358ec87ddf488f4e5a34.tar.gz gnunet-fd921d12bd321648bb44358ec87ddf488f4e5a34.zip |
-rps _peers: add disable option to peer storage
Diffstat (limited to 'src')
-rw-r--r-- | src/rps/gnunet-service-rps_peers.c | 25 | ||||
-rw-r--r-- | src/rps/rps.conf.in | 2 |
2 files changed, 25 insertions, 2 deletions
diff --git a/src/rps/gnunet-service-rps_peers.c b/src/rps/gnunet-service-rps_peers.c index d52a6cfd5..2b5f39857 100644 --- a/src/rps/gnunet-service-rps_peers.c +++ b/src/rps/gnunet-service-rps_peers.c | |||
@@ -782,10 +782,26 @@ store_valid_peers () | |||
782 | { | 782 | { |
783 | struct GNUNET_DISK_FileHandle *fh; | 783 | struct GNUNET_DISK_FileHandle *fh; |
784 | uint32_t number_written_peers; | 784 | uint32_t number_written_peers; |
785 | int ret; | ||
786 | |||
787 | if (0 == strncmp ("DISABLE", filename_valid_peers, 7)) | ||
788 | { | ||
789 | return; | ||
790 | } | ||
785 | 791 | ||
786 | if (GNUNET_OK != | 792 | ret = GNUNET_DISK_directory_create_for_file (filename_valid_peers); |
787 | GNUNET_DISK_directory_create_for_file (filename_valid_peers)) | 793 | if (GNUNET_SYSERR == ret) |
794 | { | ||
795 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
796 | "Not able to create directory for file `%s'\n", | ||
797 | filename_valid_peers); | ||
798 | GNUNET_break (0); | ||
799 | } | ||
800 | else if (GNUNET_NO == ret) | ||
788 | { | 801 | { |
802 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
803 | "Directory for file `%s' exists but is not writable for us\n", | ||
804 | filename_valid_peers); | ||
789 | GNUNET_break (0); | 805 | GNUNET_break (0); |
790 | } | 806 | } |
791 | fh = GNUNET_DISK_file_open (filename_valid_peers, | 807 | fh = GNUNET_DISK_file_open (filename_valid_peers, |
@@ -872,6 +888,11 @@ restore_valid_peers () | |||
872 | const char *str_repr; | 888 | const char *str_repr; |
873 | const struct GNUNET_PeerIdentity *peer; | 889 | const struct GNUNET_PeerIdentity *peer; |
874 | 890 | ||
891 | if (0 == strncmp ("DISABLE", filename_valid_peers, 7)) | ||
892 | { | ||
893 | return; | ||
894 | } | ||
895 | |||
875 | if (GNUNET_OK != GNUNET_DISK_file_test (filename_valid_peers)) | 896 | if (GNUNET_OK != GNUNET_DISK_file_test (filename_valid_peers)) |
876 | { | 897 | { |
877 | return; | 898 | return; |
diff --git a/src/rps/rps.conf.in b/src/rps/rps.conf.in index 0b4aa0838..046a8b5d9 100644 --- a/src/rps/rps.conf.in +++ b/src/rps/rps.conf.in | |||
@@ -16,6 +16,8 @@ ROUNDINTERVAL = 30 s | |||
16 | 16 | ||
17 | # This is the file in which valid peers are stored | 17 | # This is the file in which valid peers are stored |
18 | FILENAME_VALID_PEERS = $GNUNET_DATA_HOME/rps/valid_peers.txt | 18 | FILENAME_VALID_PEERS = $GNUNET_DATA_HOME/rps/valid_peers.txt |
19 | # Disable storage of valid peers | ||
20 | #FILENAME_VALID_PEERS = DISABLE | ||
19 | 21 | ||
20 | # This is the 'estimate' in the beginning. | 22 | # This is the 'estimate' in the beginning. |
21 | # This determines the size of the peers we keep in memory | 23 | # This determines the size of the peers we keep in memory |