Skip to content

Commit

Permalink
Fix mosquitto_sub pipe close detection.
Browse files Browse the repository at this point in the history
If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect
that the pipe has closed and disconnect.

Closes #2164. Thanks to Frantisek Fuka.
  • Loading branch information
ralight committed Apr 6, 2021
1 parent 229b1f7 commit ec54bce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ChangeLog.txt
@@ -1,3 +1,11 @@
2.0.11 - 2021-xx-xx
===================

Clients:
- If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect
that the pipe has closed and disconnect. Closes #2164.


2.0.10 - 2021-04-03
==================

Expand Down
3 changes: 3 additions & 0 deletions client/sub_client.c
Expand Up @@ -96,6 +96,9 @@ static void my_message_callback(struct mosquitto *mosq, void *obj, const struct
}

print_message(&cfg, message, properties);
if(ferror(stdout)){
mosquitto_disconnect_v5(mosq, 0, cfg.disconnect_props);
}

if(cfg.msg_count>0){
msg_count++;
Expand Down

0 comments on commit ec54bce

Please sign in to comment.