fix(style): Format using dart format
This commit is contained in:
parent
38155051f5
commit
8b0f118e2d
@ -22,7 +22,8 @@ class TCPSocketWrapper extends BaseSocketWrapper {
|
||||
final StreamController<String> _dataStream = StreamController.broadcast();
|
||||
|
||||
/// The stream of outgoing (TCPSocketWrapper -> XmppConnection) events.
|
||||
final StreamController<XmppSocketEvent> _eventStream = StreamController.broadcast();
|
||||
final StreamController<XmppSocketEvent> _eventStream =
|
||||
StreamController.broadcast();
|
||||
|
||||
/// A subscription on the socket's data stream.
|
||||
StreamSubscription<dynamic>? _socketSubscription;
|
||||
@ -80,7 +81,9 @@ class TCPSocketWrapper extends BaseSocketWrapper {
|
||||
results.sort(srvRecordSortComparator);
|
||||
for (final srv in results) {
|
||||
try {
|
||||
_log.finest('Attempting secure connection to ${srv.target}:${srv.port}...');
|
||||
_log.finest(
|
||||
'Attempting secure connection to ${srv.target}:${srv.port}...',
|
||||
);
|
||||
|
||||
// Workaround: We cannot set the SNI directly when using SecureSocket.connect.
|
||||
// instead, we connect using a regular socket and then secure it. This allows
|
||||
@ -93,14 +96,14 @@ class TCPSocketWrapper extends BaseSocketWrapper {
|
||||
_socket = await SecureSocket.secure(
|
||||
sock,
|
||||
host: domain,
|
||||
supportedProtocols: const [ xmppClientALPNId ],
|
||||
supportedProtocols: const [xmppClientALPNId],
|
||||
onBadCertificate: (cert) => onBadCertificate(cert, domain),
|
||||
);
|
||||
|
||||
_secure = true;
|
||||
_log.finest('Success!');
|
||||
return true;
|
||||
} on Exception catch(e) {
|
||||
} on Exception catch (e) {
|
||||
_log.finest('Failure! $e');
|
||||
|
||||
if (e is HandshakeException) {
|
||||
@ -132,7 +135,7 @@ class TCPSocketWrapper extends BaseSocketWrapper {
|
||||
|
||||
_log.finest('Success!');
|
||||
return true;
|
||||
} on Exception catch(e) {
|
||||
} on Exception catch (e) {
|
||||
_log.finest('Failure! $e');
|
||||
continue;
|
||||
}
|
||||
@ -154,7 +157,7 @@ class TCPSocketWrapper extends BaseSocketWrapper {
|
||||
);
|
||||
_log.finest('Success!');
|
||||
return true;
|
||||
} on Exception catch(e) {
|
||||
} on Exception catch (e) {
|
||||
_log.finest('Failure! $e');
|
||||
return false;
|
||||
}
|
||||
@ -187,7 +190,7 @@ class TCPSocketWrapper extends BaseSocketWrapper {
|
||||
|
||||
_socket = await SecureSocket.secure(
|
||||
_socket!,
|
||||
supportedProtocols: const [ xmppClientALPNId ],
|
||||
supportedProtocols: const [xmppClientALPNId],
|
||||
onBadCertificate: (cert) => onBadCertificate(cert, domain),
|
||||
);
|
||||
|
||||
@ -232,7 +235,7 @@ class TCPSocketWrapper extends BaseSocketWrapper {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> connect(String domain, { String? host, int? port }) async {
|
||||
Future<bool> connect(String domain, {String? host, int? port}) async {
|
||||
_expectSocketClosure = false;
|
||||
_secure = false;
|
||||
|
||||
@ -280,7 +283,7 @@ class TCPSocketWrapper extends BaseSocketWrapper {
|
||||
|
||||
try {
|
||||
_socket!.close();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
_log.warning('Closing socket threw exception: $e');
|
||||
}
|
||||
}
|
||||
@ -289,10 +292,11 @@ class TCPSocketWrapper extends BaseSocketWrapper {
|
||||
Stream<String> getDataStream() => _dataStream.stream.asBroadcastStream();
|
||||
|
||||
@override
|
||||
Stream<XmppSocketEvent> getEventStream() => _eventStream.stream.asBroadcastStream();
|
||||
Stream<XmppSocketEvent> getEventStream() =>
|
||||
_eventStream.stream.asBroadcastStream();
|
||||
|
||||
@override
|
||||
void write(Object? data, { String? redact }) {
|
||||
void write(Object? data, {String? redact}) {
|
||||
if (_socket == null) {
|
||||
_log.severe('Failed to write to socket as _socket is null');
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user