We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Disposing observeStringStream() doesnot cancel the subscriber from observeByteStream() causing exception when trying to close connection.
Caused by: com.github.ivbaranov.rxbluetooth.exceptions.ConnectionClosedException: Can't read stream.
Start reading string stream: Disposable disposable = mBluetoothConnection.observeStringStream() .subscribeOn(Schedulers.computation()) .subscribe(s -> Log.e("Data", s));
Disposable disposable = mBluetoothConnection.observeStringStream() .subscribeOn(Schedulers.computation()) .subscribe(s -> Log.e("Data", s));
Stop reading stream: disposable.dispose()
disposable.dispose()
Call bluetooth.closeConnection()
bluetooth.closeConnection()
Never cancels subscriber and throws exception Class BluetoothConnection.java
public Flowable<Byte> observeByteStream() { if (observeInputStream == null) { observeInputStream = Flowable.create(new FlowableOnSubscribe<Byte>() { @Override public void subscribe(final FlowableEmitter<Byte> subscriber) { while (!subscriber.isCancelled()) { try { subscriber.onNext((byte) inputStream.read()); } catch (IOException e) { connected = false; **subscriber.onError(new ConnectionClosedException("Can't read stream", e));** } finally { if (!connected) { closeConnection(); } } } } }, BackpressureStrategy.BUFFER).share(); } return observeInputStream; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Disposing observeStringStream() doesnot cancel the subscriber from observeByteStream() causing exception when trying to close connection.
Start reading string stream:
Disposable disposable = mBluetoothConnection.observeStringStream() .subscribeOn(Schedulers.computation()) .subscribe(s -> Log.e("Data", s));
Stop reading stream:
disposable.dispose()
Call
bluetooth.closeConnection()
Never cancels subscriber and throws exception
Class BluetoothConnection.java
The text was updated successfully, but these errors were encountered: