Skip to content

Commit

Permalink
fix: Release remote interface resource correctly
Browse files Browse the repository at this point in the history
Release resource correctly when unexpected things happen such as
the RabbitMQ broker is turned off accidentally.
  • Loading branch information
marktwtn committed Sep 8, 2019
1 parent 6cd8ea7 commit f60c522
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dcurl.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ int8_t *dcurl_entry(int8_t *trytes, int mwm, int threads)

remote_pow:
if (!doRemoteContext(&Remote_Context, pow_ctx)) {
/* The remote interface can not work without activated RabbitMQ broker
* and remote worker. If it is not working, the PoW would be calculated
* by the local machine. And the remote interface resource should be
* released.
*/
freeRemoteContext(&Remote_Context, pow_ctx);
exitRemoteContext(&Remote_Context);
uv_sem_post(&notify_remote);
goto local_pow;
} else {
res = getRemoteResult(&Remote_Context, pow_ctx);
Expand Down

0 comments on commit f60c522

Please sign in to comment.