Skip to content

Commit

Permalink
Fix concurrency on the client (#183)
Browse files Browse the repository at this point in the history
* reworked peer connection establishment logic eliminating race conditions and deadlocks while running many peers
  • Loading branch information
braginini authored Jan 10, 2022
1 parent 828410b commit 319632f
Show file tree
Hide file tree
Showing 25 changed files with 1,216 additions and 898 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/golang-test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
on:
push:
branches:
- main
pull_request:
name: Test Build On Platforms
jobs:
test_build:
strategy:
matrix:
os: [ windows, linux, darwin ]
go-version: [1.17.x]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install modules
run: go mod tidy

- name: run build client
run: GOOS=${{ matrix.os }} go build .
working-directory: client

- name: run build management
run: GOOS=${{ matrix.os }} go build .
working-directory: management

- name: run build signal
run: GOOS=${{ matrix.os }} go build .
working-directory: signal
54 changes: 14 additions & 40 deletions .github/workflows/golang-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
branches:
- main
pull_request:
name: Test
name: Test Code
jobs:
test:
strategy:
Expand All @@ -15,45 +15,19 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: update limits.d
run: |
cat <<'EOF' | sudo tee -a /etc/security/limits.d/wt.conf
root soft nproc 65535
root hard nproc 65535
root soft nofile 65535
root hard nofile 65535
$(whoami) soft nproc 65535
$(whoami) hard nproc 65535
$(whoami) soft nofile 65535
$(whoami) hard nofile 65535
EOF
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: GOBIN=$(which go) && sudo --preserve-env=GOROOT $GOBIN test -p 1 ./...

test_build:
strategy:
matrix:
os: [ windows, linux, darwin ]
go-version: [1.17.x]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install modules
run: go mod tidy

- name: run build client
run: GOOS=${{ matrix.os }} go build .
working-directory: client

- name: run build management
run: GOOS=${{ matrix.os }} go build .
working-directory: management

- name: run build signal
run: GOOS=${{ matrix.os }} go build .
working-directory: signal
run: GOBIN=$(which go) && sudo --preserve-env=GOROOT $GOBIN test -p 1 ./...
1 change: 1 addition & 0 deletions client/cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func createEngineConfig(key wgtypes.Key, config *internal.Config, peerConfig *mg
WgAddr: peerConfig.Address,
IFaceBlackList: iFaceBlackList,
WgPrivateKey: key,
WgPort: internal.WgPort,
}

if config.PreSharedKey != "" {
Expand Down
2 changes: 1 addition & 1 deletion client/cmd/up_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestUp_Start(t *testing.T) {

func TestUp(t *testing.T) {

defer iface.Close()
defer iface.Close("wt0")

tempDir := t.TempDir()
confPath := tempDir + "/config.json"
Expand Down
32 changes: 0 additions & 32 deletions client/internal/cond.go

This file was deleted.

Loading

0 comments on commit 319632f

Please sign in to comment.