check time before retrieving peers
@@ -40,6 +40,11 @@ void peerfile_export( void ) {
return;
}
+ if( (time_now_sec() - gconf->startup_time) < (5 * 60) ) {
+ log_info( "PEERFILE: No peers exported. KadNode needs to run at least 5 minutes." );
+ return;
+ }
+
num = kad_export_nodes( addrs, N_ELEMS(addrs) );
if( num < 0 ) {
@@ -53,11 +58,6 @@ void peerfile_export( void ) {
return;
}
- if( (time_now_sec() - gconf->startup_time) < (5 * 60) ) {
- log_info( "PEERFILE: No peers exported. KadNode needs to run at least 5 minutes." );
- return;
- }
-
fp = fopen( filename, "w" );
if( fp == NULL ) {
log_warn( "PEERFILE: Cannot open file '%s' for peer export: %s", filename, strerror( errno ) );
