bluez5: Don't deref the transport to get the fd

Use the configured fd in the source for reading and writing because
the transport might be disconnected and cleared from the main thread
at any time.
This commit is contained in:
Wim Taymans 2020-12-14 13:17:48 +01:00
parent 580bdcd5bf
commit 7f6339e307
2 changed files with 2 additions and 2 deletions

View file

@ -343,7 +343,7 @@ static int send_buffer(struct impl *this)
spa_log_trace(this->log, NAME " %p: send %d %u %u %u",
this, this->frame_count, this->seqnum, this->timestamp, this->buffer_used);
written = send(this->transport->fd, this->buffer, this->buffer_used, MSG_DONTWAIT | MSG_NOSIGNAL);
written = send(this->flush_source.fd, this->buffer, this->buffer_used, MSG_DONTWAIT | MSG_NOSIGNAL);
reset_buffer(this);
spa_log_debug(this->log, NAME " %p: send %d: %m", this, written);

View file

@ -321,7 +321,7 @@ static int32_t read_data(struct impl *this) {
again:
/* read data from socket */
size_read = read(this->transport->fd, this->buffer_read, b_size);
size_read = read(this->source.fd, this->buffer_read, b_size);
if (size_read == 0)
return 0;