summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common.c2
-rw-r--r--src/packet_stream.c3
-rw-r--r--src/socket/socket_linux.c4
-rw-r--r--src/socket/socket_windows.c2
4 files changed, 6 insertions, 5 deletions
diff --git a/src/common.c b/src/common.c
index 797090d..7034971 100644
--- a/src/common.c
+++ b/src/common.c
@@ -86,7 +86,7 @@ bool nn_common_init(const char *thread_name)
free, malloc_lock, malloc_unlock);
#endif
- al_rand_init((u32)(nn_get_timestamp() / 1000));
+ al_rand_init((u32)(nn_get_timestamp() / 1000000));
#ifdef NAUNET_ON_WINDOWS
if (!nn_windows_init()) return false;
diff --git a/src/packet_stream.c b/src/packet_stream.c
index b183df5..0cf296c 100644
--- a/src/packet_stream.c
+++ b/src/packet_stream.c
@@ -40,7 +40,8 @@ static void shutdown_internal(struct nn_packet_stream *stream)
static void discard_out_queue_internal(struct nn_packet_stream *stream)
{
- al_assert(!stream->out.running);
+ // stream->out.running can be true here. The stream will stop the
+ // write event by itself if the out queue is empty.
if (stream->out.packet) {
stream->packet_sent_callback(stream->userdata, stream->out.packet);
stream->out.packet = NULL;
diff --git a/src/socket/socket_linux.c b/src/socket/socket_linux.c
index 70d9184..6a97556 100644
--- a/src/socket/socket_linux.c
+++ b/src/socket/socket_linux.c
@@ -219,11 +219,11 @@ bool nn_socket_accept(struct nn_socket *sock, struct nn_socket *cl, s32 flags)
port = ntohs(saddr->sin6_port);
inet_ntop(AF_INET6, &saddr->sin6_addr, addr_str, sizeof(addr_str));
}
- log_debug("Connection from %s:%hu.", addr_str, port);
+ log_info("Connection from %s:%hu.", addr_str, port);
break;
}
case NNWT_SOCKET_UNIX:
- log_debug("Connection on UNIX socket.");
+ log_info("Connection on UNIX socket.");
break;
}
diff --git a/src/socket/socket_windows.c b/src/socket/socket_windows.c
index 69fa55b..3cf316f 100644
--- a/src/socket/socket_windows.c
+++ b/src/socket/socket_windows.c
@@ -113,7 +113,7 @@ bool nn_socket_connect(struct nn_socket *sock, str *addr, u16 port)
s32 ret = connect(sock->fd, (SOCKADDR *)&sock->addr_in, sizeof(sock->addr_in));
if (ret == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK) {
- log_error("connect() failed: %d.", WSAGetLastError());
+ log_error("connect(%.*s:%hu) failed: %d.", nn_addr_x(addr), port, WSAGetLastError());
return false;
}