waitForClientDataSocket method
Implementation
Future<void> waitForClientDataSocket({Duration? timeout}) {
var result = dataListener!.first;
if (timeout != null) {
result = result.timeout(timeout, onTimeout: () {
throw TimeoutException(
'Timeout reached while waiting for client data socket');
});
}
return result.then((value) {
dataSocket = value;
}).catchError((Object e) {
// dataListener was closed before a client connected (e.g. session ended)
logger.generalLog('Data connection wait cancelled: $e');
});
}