Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiny enhancements #63

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/netlog/netlog-dtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int dtls_connect(DTLSManager *m, SocketAddress *address) {
if (r < 0)
return r;

log_debug("Connected to remote server'%s'", pretty);
log_debug("Connected to remote server: '%s'", pretty);

ctx = SSL_CTX_new(DTLS_method());
if (!ctx)
Expand Down
12 changes: 10 additions & 2 deletions src/netlog/netlog-network.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stddef.h>
#include <unistd.h>

#include "alloc-util.h"
#include "fd-util.h"
#include "io-util.h"
#include "netlog-manager.h"
Expand Down Expand Up @@ -316,16 +317,17 @@ int manager_push_to_network(Manager *m,
void manager_close_network_socket(Manager *m) {
assert(m);

if (m->protocol == SYSLOG_TRANSMISSION_PROTOCOL_TCP) {
if (m->protocol == SYSLOG_TRANSMISSION_PROTOCOL_TCP && m->socket >= 0) {
int r = shutdown(m->socket, SHUT_RDWR);
if (r < 0)
log_error_errno(r, "Failed to shutdown netlog socket: %m");
log_error_errno(errno, "Failed to shutdown netlog socket: %m");
}

m->socket = safe_close(m->socket);
}

int manager_network_connect_socket(Manager *m) {
_cleanup_free_ char *pretty = NULL;
union sockaddr_union sa;
socklen_t salen;
int r;
Expand Down Expand Up @@ -357,6 +359,12 @@ int manager_network_connect_socket(Manager *m) {
if (r < 0 && errno != EINPROGRESS)
return -errno;

r = sockaddr_pretty(&m->address.sockaddr.sa, salen, true, true, &pretty);
if (r < 0)
return r;

log_debug("Connected to remote server: '%s'", pretty);

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/netlog/netlog-tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int tls_connect(TLSManager *m, SocketAddress *address) {
if (r < 0)
return r;

log_debug("Connected to remote server'%s'", pretty);
log_debug("Connected to remote server: '%s'", pretty);

ctx = SSL_CTX_new(SSLv23_client_method());
if (!ctx)
Expand Down