Fixed annoying debugging message and UTF8 issue

This commit is contained in:
WolverinDEV 2019-12-08 14:18:41 +01:00
parent 6131005658
commit dbd8e73ab5
No known key found for this signature in database
GPG Key ID: 77A6C15085150EEB
2 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ NAN_METHOD(audio::available_devices) {
auto device_info = Nan::New<v8::Object>();
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<v8::String>("driver").ToLocalChecked(), Nan::New<v8::String>(device->driver).ToLocalChecked());
Nan::Set(device_info, Nan::New<v8::String>("device_id").ToLocalChecked(), Nan::New<v8::String>(base64::encode(digest::sha1(device->name + device->driver))).ToLocalChecked());

View File

@ -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));