Skip to content
New issue

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

Tuning 30s reconnect, force disconnect for dirty state #1272

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/lib/providers/capture_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ class CaptureProvider extends ChangeNotifier
void _startKeepAliveServices() {
if (_recordingDevice != null && _socket?.state != SocketServiceState.connected) {
_keepAliveTimer?.cancel();
_keepAliveTimer = Timer.periodic(const Duration(seconds: 15), (t) async {
_keepAliveTimer = Timer.periodic(const Duration(seconds: 30), (t) async {
debugPrint("[Provider] keep alive...");

if (_recordingDevice == null || _socket?.state == SocketServiceState.connected) {
Expand Down
6 changes: 2 additions & 4 deletions app/lib/services/sockets/pure_socket.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,8 @@ class PureSocket implements IPureSocket {

@override
Future disconnect() async {
if (_status == PureSocketStatus.connected) {
// Warn: should not use await cause dead end by socket closed.
_channel?.sink.close(socket_channel_status.normalClosure);
}
// Warn: should not use await cause dead end by socket closed.
_channel?.sink.close(socket_channel_status.normalClosure);
_status = PureSocketStatus.disconnected;
onClosed();
}
Expand Down