[mob][photos] Add timeout for stop casting
This commit is contained in:
parent
7411125194
commit
195ad01f14
1 changed files with 10 additions and 3 deletions
|
@ -71,9 +71,16 @@ class CastServiceImpl extends CastService {
|
|||
final sessions = CastSessionManager().sessions;
|
||||
for (final session in sessions) {
|
||||
debugPrint("send close message for ${session.sessionId}");
|
||||
session.sendMessage(CastSession.kNamespaceConnection, {
|
||||
'type': 'CLOSE',
|
||||
});
|
||||
Future(() {
|
||||
session.sendMessage(CastSession.kNamespaceConnection, {
|
||||
'type': 'CLOSE',
|
||||
});
|
||||
}).timeout(
|
||||
const Duration(seconds: 5),
|
||||
onTimeout: () {
|
||||
print('sendMessage timed out after 5 seconds');
|
||||
},
|
||||
);
|
||||
debugPrint("close session ${session.sessionId}");
|
||||
session.close();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue