From dbd8e73ab5d34c414f8d135e99f0fa81965131bc Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sun, 8 Dec 2019 14:18:41 +0100 Subject: [PATCH] Fixed annoying debugging message and UTF8 issue --- native/serverconnection/src/audio/js/AudioPlayer.cpp | 2 +- native/serverconnection/src/connection/Socket.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/native/serverconnection/src/audio/js/AudioPlayer.cpp b/native/serverconnection/src/audio/js/AudioPlayer.cpp index dcf6d66..f4b224b 100644 --- a/native/serverconnection/src/audio/js/AudioPlayer.cpp +++ b/native/serverconnection/src/audio/js/AudioPlayer.cpp @@ -29,7 +29,7 @@ NAN_METHOD(audio::available_devices) { auto device_info = Nan::New(); auto device = devices[index]; - Nan::Set(device_info, Nan::LocalString("name"), Nan::LocalString(device->name)); + Nan::Set(device_info, Nan::LocalString("name"), Nan::LocalStringUTF8(device->name)); Nan::Set(device_info, Nan::New("driver").ToLocalChecked(), Nan::New(device->driver).ToLocalChecked()); Nan::Set(device_info, Nan::New("device_id").ToLocalChecked(), Nan::New(base64::encode(digest::sha1(device->name + device->driver))).ToLocalChecked()); diff --git a/native/serverconnection/src/connection/Socket.cpp b/native/serverconnection/src/connection/Socket.cpp index 0738d77..43a86fa 100644 --- a/native/serverconnection/src/connection/Socket.cpp +++ b/native/serverconnection/src/connection/Socket.cpp @@ -147,7 +147,7 @@ void UDPSocket::callback_read(evutil_socket_t fd) { source_address_length = sizeof(sockaddr); read_length = recvfrom(fd, (char*) buffer, (int) buffer_length, MSG_DONTWAIT, &source_address, &source_address_length); if(read_length <= 0) { - if(errno == EAGAIN) + if(errno == EAGAIN || read_length == 0) break; logger::warn(category::socket, tr("Failed to receive data: {}/{}"), errno, strerror(errno));