Browse Source

Fix build for Windows (#1377) (#1506)

* Fix build for Windows (#1377)

* Add tests for windows
pull/1508/head
Jack 4 years ago committed by GitHub
parent
commit
651caeba91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/test.yaml
  2. 3
      core/chat/concurrentConnections.go
  3. 6
      core/chat/concurrentConnections_windows.go
  4. 3
      core/chat/utils.go
  5. 12
      core/chat/utils_windows.go

2
.github/workflows/test.yaml

@ -6,7 +6,7 @@ jobs: @@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
go-version: [1.15.x, 1.16.x]
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2

3
core/chat/concurrentConnections.go

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
// nolint:goimports
// +build !freebsd
//go:build !freebsd && !windows
// +build !freebsd,!windows
package chat

6
core/chat/concurrentConnections_windows.go

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
//go:build windows
// +build windows
package chat
func setSystemConcurrentConnectionLimit(limit int64) {}

3
core/chat/utils.go

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
//go:build !windows
// +build !windows
package chat
import (

12
core/chat/utils_windows.go

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
//go:build windows
// +build windows
package chat
func getMaximumConcurrentConnectionLimit() int64 {
// The maximum limit I can find for windows is 16,777,216
// (essentially unlimited, but add the 0.7 multiplier as well to be
// consistent with other systems)
// https://docs.microsoft.com/en-gb/archive/blogs/markrussinovich/pushing-the-limits-of-windows-handles
return (16777216 * 7) / 10
}
Loading…
Cancel
Save