Skip to content

Commit

Permalink
Improve error messages in some situations when clients disconnect.
Browse files Browse the repository at this point in the history
Reduces the number of "Socket error on client X, disconnecting"
messages.
  • Loading branch information
ralight committed Sep 17, 2019
1 parent e06b726 commit 0415208
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Broker:
- Fix bridges potentially not connecting on Windows. Closes #478.
- Fix clients authorised using `use_identity_as_username` or
`use_subject_as_username` being disconnected on SIGHUP. Closes #1402.
- Improve error messages in some situations when clients disconnect. Reduces
the number of "Socket error on client X, disconnecting" messages.

Client library:
- Fix reconnect backoff for the situation where connections are dropped rather
Expand Down
11 changes: 7 additions & 4 deletions src/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol
#endif
int err;
socklen_t len;
int rc;

#ifdef WITH_EPOLL
int i;
Expand Down Expand Up @@ -780,8 +781,9 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol
continue;
}
}
if(packet__write(context)){
do_disconnect(db, context, MOSQ_ERR_CONN_LOST);
rc = packet__write(context);
if(rc){
do_disconnect(db, context, rc);
continue;
}
}
Expand Down Expand Up @@ -822,8 +824,9 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol
#endif
#endif
do{
if(packet__read(db, context)){
do_disconnect(db, context, MOSQ_ERR_CONN_LOST);
rc = packet__read(db, context);
if(rc){
do_disconnect(db, context, rc);
continue;
}
}while(SSL_DATA_PENDING(context));
Expand Down

0 comments on commit 0415208

Please sign in to comment.