mirror of
https://github.com/optim-enterprises-bv/nDPId.git
synced 2025-11-01 02:37:48 +00:00
error handling enhancements
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
@@ -112,6 +112,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "JSON parsing failed with return value %d at position %u\n", r, parser.pos);
|
fprintf(stderr, "JSON parsing failed with return value %d at position %u\n", r, parser.pos);
|
||||||
fprintf(stderr, "JSON string: '%.*s'\n", (int)(json_bytes - json_start), (char *)(buf + json_start));
|
fprintf(stderr, "JSON string: '%.*s'\n", (int)(json_bytes - json_start), (char *)(buf + json_start));
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i < r; i++)
|
for (int i = 1; i < r; i++)
|
||||||
|
|||||||
2
nDPId.c
2
nDPId.c
@@ -729,7 +729,7 @@ static void send_to_json_sink(struct nDPId_reader_thread * const reader_thread,
|
|||||||
}
|
}
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if (reader_thread->json_sock_reconnect == 0 && write(reader_thread->json_sockfd, newline_json_str, s_ret) <= 0)
|
if (reader_thread->json_sock_reconnect == 0 && write(reader_thread->json_sockfd, newline_json_str, s_ret) != s_ret)
|
||||||
{
|
{
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
syslog(LOG_DAEMON | LOG_ERR,
|
syslog(LOG_DAEMON | LOG_ERR,
|
||||||
|
|||||||
@@ -166,7 +166,8 @@ static void disconnect_client(int epollfd, struct remote_desc * const current)
|
|||||||
{
|
{
|
||||||
if (epoll_ctl(epollfd, EPOLL_CTL_DEL, current->fd, NULL) < 0)
|
if (epoll_ctl(epollfd, EPOLL_CTL_DEL, current->fd, NULL) < 0)
|
||||||
{
|
{
|
||||||
syslog(LOG_DAEMON | LOG_ERR, "Error deleting fd from epollq: %s", strerror(errno));
|
syslog(LOG_DAEMON | LOG_ERR, "Error deleting fd %d from epollq %d: %s",
|
||||||
|
current->fd, epollfd, strerror(errno));
|
||||||
}
|
}
|
||||||
if (close(current->fd) != 0)
|
if (close(current->fd) != 0)
|
||||||
{
|
{
|
||||||
@@ -446,9 +447,7 @@ int main(int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
if (bytes_read == 0)
|
if (bytes_read == 0)
|
||||||
{
|
{
|
||||||
syslog(LOG_DAEMON,
|
syslog(LOG_DAEMON, "collector connection closed during read");
|
||||||
"%s connection closed during read",
|
|
||||||
(current->type == JSON_SOCK ? "collector" : "distributor"));
|
|
||||||
disconnect_client(epollfd, current);
|
disconnect_client(epollfd, current);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user