Fix value of CHUNK_SERVER_RECONNECT_TIME by expressing it in seconds, also change it to a runtime-modifiable value
This commit is contained in:
+3
-1
@@ -907,6 +907,8 @@ int chunk_server_init(ChunkServer *state, int argc, char **argv, void **contexts
|
||||
|
||||
state->trace = trace;
|
||||
|
||||
state->reconnect_delay = 1; // 1 second
|
||||
|
||||
tcp_context_init(&state->tcp);
|
||||
|
||||
int ret = tcp_listen(&state->tcp, addr, port);
|
||||
@@ -1109,7 +1111,7 @@ int chunk_server_step(ChunkServer *state, void **contexts, struct pollfd *polled
|
||||
start_download(state);
|
||||
|
||||
if (state->disconnect_time != INVALID_TIME) {
|
||||
Time reconnect_time = state->disconnect_time + (Time) CHUNK_SERVER_RECONNECT_TIME * 1000000000;
|
||||
Time reconnect_time = state->disconnect_time + (Time) state->reconnect_delay * 1000000000;
|
||||
if (reconnect_time <= current_time) {
|
||||
state->disconnect_time = INVALID_TIME;
|
||||
if (start_connecting_to_metadata_server(state) < 0)
|
||||
|
||||
+1
-2
@@ -10,8 +10,6 @@
|
||||
#define TAG_METADATA_SERVER 1
|
||||
#define TAG_CHUNK_SERVER 2
|
||||
|
||||
#define CHUNK_SERVER_RECONNECT_TIME 10000
|
||||
|
||||
typedef struct {
|
||||
char path[PATH_MAX];
|
||||
} ChunkStore;
|
||||
@@ -37,6 +35,7 @@ typedef struct {
|
||||
|
||||
Time disconnect_time;
|
||||
Time last_sync_time;
|
||||
int reconnect_delay; // In seconds
|
||||
|
||||
TCP tcp;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user