Commit Graph

3 Commits

Author SHA1 Message Date
Andreas Herrmann
a1da025b78
FreePort draw from outside ephemeral port range (#10774)
* Test case for LockedFreePort not colliding with port 0

changelog_begin
changelog_end

* Discover dynamic port range on Linux

* Random port generator outside ephemeral range

* remove dev comments

* Draw FreePort from outside the ephemeral port range

Note, there is a race condition between the socket being closed and the
lock-file being created in LockedFreePort. This is not a new issue, it
was already present with the previous port 0 based implementation.

LockedFreePort handles this by attempting to find a free port and taking
a file lock multiple times.

But, it could happen that A `find`s port N, and obtains the lock, but
doesn't bind port N again, yet; then B binds port N during `find`; then
A attempts to bind port N before B could release it again and fails
because B still holds it.

* Select dynamic port range based on OS

* Detect dynamic port range on MacOS and Windows

* Import sysctl from Nix on MacOS

changelog_begin
changelog_end

* Windows line separator

* FreePort helpers visibility

* Use more informative exception types

* Use a more light weight unit test

* Add comments

* Fix Windows

* Update libs-scala/ports/src/main/scala/com/digitalasset/ports/FreePort.scala

Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>

* Update libs-scala/ports/src/main/scala/com/digitalasset/ports/FreePort.scala

Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>

* Add a comment to clarify the generated port range

* fmt

* unused import

* Split libs-scala/ports

Splits the FreePort and LockedFreePort components into a separate
library as this is only used for testing purposes.

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2021-09-07 15:41:43 +02:00
Stefano Baghino
0e4af7418d
Add runner for non-repudiation (#9076)
* Add runner for non-repudiation

Closes #8633

changelog_begin
changelog_end

* Fix existing tests

* Add test for non-repudiation-app option parser

* Remove unnecessary dependencies from non-repudiation testing

* Fix Scala 2.13 build errors

* Fix help message for --api-address and --api-port
2021-03-11 10:57:50 +01:00
Stefano Baghino
eaf7fb6f63
Add non-repudiation API (#8982)
* Add non-repudiation API

The Web API for the non-repudiation proxy allows to retrieve the signed
payload for a given command, add a new certificate or query for an
existing one.

Closes #8658

changelog_begin
changelog_end

* Fix Scala 2.13 compilation error

* Test error conditions

* Add tests for errors and logging

* Fix Scala 2.13 compilation error

* Address https://github.com/digital-asset/daml/pull/8982#discussion_r585641768

* Address https://github.com/digital-asset/daml/pull/8982#discussion_r585674885

* Address https://github.com/digital-asset/daml/pull/8982#discussion_r585668733
2021-03-04 11:02:25 +00:00