Only keep reading from stdin if we are connected.

pull/1072/head
Roger Light 7 years ago
parent f809ecbcbe
commit 36e8659762

@ -177,7 +177,7 @@ int pub_shared_loop(struct mosquitto *mosq)
if(status == STATUS_CONNACK_RECVD){
pos = 0;
read_len = buf_len;
while(fgets(&buf[pos], read_len, stdin)){
while(connected && fgets(&buf[pos], read_len, stdin)){
buf_len_actual = strlen(buf);
if(buf[buf_len_actual-1] == '\n'){
buf[buf_len_actual-1] = '\0';

Loading…
Cancel
Save