addConn method
Implementation
void addConn(Direction dir, bool usefd) {
if (_isDone) {
throw _wrapError(network_errors.ResourceScopeClosedException());
}
final err = _resources.addConn(dir, usefd);
if (err != null) {
throw _wrapError(err);
}
try {
_addConnForAncestors(dir, usefd);
} catch (e) {
_resources.removeConn(dir, usefd); // Rollback
if (e is network_errors.ResourceLimitExceededException ||
e is network_errors.ResourceScopeClosedException) {
rethrow;
} else if (e is Exception) {
throw _wrapError(e);
} else {
rethrow;
}
}
}