Skip to content

Commit 2776c3d

Browse files
authored
Merge pull request #704 from panjf2000/dev
minor: v2.8.0
2 parents 17f8c51 + 4657bec commit 2776c3d

29 files changed

+1814
-432
lines changed

.github/workflows/cross-compile-bsd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
fail-fast: false
3333
matrix:
34-
go: ['1.20', '1.23']
34+
go: ['1.20', '1.24']
3535
os:
3636
- ubuntu-latest
3737
name: Go ${{ matrix.go }} @ ${{ matrix.os }}

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ jobs:
4747
cache: false
4848

4949
- name: Setup and run golangci-lint
50-
uses: golangci/golangci-lint-action@v6
50+
uses: golangci/golangci-lint-action@v7
5151
with:
52-
version: v1.61.0
53-
args: -v -E gofumpt -E gocritic -E misspell -E revive -E godot --timeout 5m
52+
version: v2.1.5
53+
args: -v -E gocritic -E misspell -E revive -E godot --timeout 5m
5454
test:
5555
needs: lint
5656
strategy:
5757
fail-fast: false
5858
matrix:
59-
go: ['1.20', '1.23']
59+
go: ['1.20', '1.24']
6060
os:
6161
- ubuntu-latest
6262
- macos-latest

.github/workflows/test_gc_opt.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ jobs:
4747
cache: false
4848

4949
- name: Setup and run golangci-lint
50-
uses: golangci/golangci-lint-action@v6
50+
uses: golangci/golangci-lint-action@v7
5151
with:
52-
version: v1.61.0
53-
args: -v -E gofumpt -E gocritic -E misspell -E revive -E godot --timeout 5m
52+
version: v2.1.5
53+
args: -v -E gocritic -E misspell -E revive -E godot --timeout 5m
5454
test:
5555
needs: lint
5656
strategy:
5757
fail-fast: false
5858
matrix:
59-
go: ['1.20', '1.23']
59+
go: ['1.20', '1.24']
6060
os:
6161
- ubuntu-latest
6262
- macos-latest

.github/workflows/test_poll_opt.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ jobs:
4646
cache: false
4747

4848
- name: Setup and run golangci-lint
49-
uses: golangci/golangci-lint-action@v6
49+
uses: golangci/golangci-lint-action@v7
5050
with:
51-
version: v1.61.0
52-
args: -v -E gofumpt -E gocritic -E misspell -E revive -E godot
51+
version: v2.1.5
52+
args: -v -E gocritic -E misspell -E revive -E godot
5353
test:
5454
needs: lint
5555
strategy:
5656
fail-fast: false
5757
matrix:
58-
go: ['1.20', '1.23']
58+
go: ['1.20', '1.24']
5959
os: [ubuntu-latest, macos-latest]
6060
name: Go ${{ matrix.go }} @ ${{ matrix.os }}
6161
runs-on: ${{ matrix.os }}

.github/workflows/test_poll_opt_gc_opt.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ jobs:
4646
cache: false
4747

4848
- name: Setup and run golangci-lint
49-
uses: golangci/golangci-lint-action@v6
49+
uses: golangci/golangci-lint-action@v7
5050
with:
51-
version: v1.61.0
52-
args: -v -E gofumpt -E gocritic -E misspell -E revive -E godot
51+
version: v2.1.5
52+
args: -v -E gocritic -E misspell -E revive -E godot
5353
test:
5454
needs: lint
5555
strategy:
5656
fail-fast: false
5757
matrix:
58-
go: ['1.20', '1.23']
58+
go: ['1.20', '1.24']
5959
os: [ubuntu-latest, macos-latest]
6060
name: Go ${{ matrix.go }} @ ${{ matrix.os }}
6161
runs-on: ${{ matrix.os }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ English | [中文](README_ZH.md)
4949
- [x] Running on `Linux`, `macOS`, `Windows`, and *BSD: `Darwin`/`DragonFlyBSD`/`FreeBSD`/`NetBSD`/`OpenBSD`
5050
- [x] **Edge-triggered** I/O support
5151
- [x] Multiple network addresses binding
52+
- [x] Support registering new connections to event-loops
5253

5354
## 🕊 Roadmap
5455

README_ZH.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
- [x] 支持 `Linux`, `macOS`, `Windows`*BSD 操作系统: `Darwin`/`DragonFlyBSD`/`FreeBSD`/`NetBSD`/`OpenBSD`
5050
- [x] **Edge-triggered** I/O 支持
5151
- [x] 多网络地址绑定
52+
- [x] 支持注册新的连接到事件循环
5253

5354
## 🕊 未来计划
5455

acceptor_windows.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"runtime"
2121

2222
errorx "github.com/panjf2000/gnet/v2/pkg/errors"
23+
"github.com/panjf2000/gnet/v2/pkg/pool/goroutine"
2324
)
2425

2526
func (eng *engine) listenStream(ln net.Listener) (err error) {
@@ -43,9 +44,9 @@ func (eng *engine) listenStream(ln net.Listener) (err error) {
4344
return
4445
}
4546
el := eng.eventLoops.next(tc.RemoteAddr())
46-
c := newTCPConn(tc, el)
47+
c := newTCPConn(el, tc, nil)
4748
el.ch <- &openConn{c: c}
48-
go func(c *conn, tc net.Conn, el *eventloop) {
49+
goroutine.DefaultWorkerPool.Submit(func() {
4950
var buffer [0x10000]byte
5051
for {
5152
n, err := tc.Read(buffer[:])
@@ -55,7 +56,7 @@ func (eng *engine) listenStream(ln net.Listener) (err error) {
5556
}
5657
el.ch <- packTCPConn(c, buffer[:n])
5758
}
58-
}(c, tc, el)
59+
})
5960
}
6061
}
6162

@@ -81,7 +82,7 @@ func (eng *engine) ListenUDP(pc net.PacketConn) (err error) {
8182
return
8283
}
8384
el := eng.eventLoops.next(addr)
84-
c := newUDPConn(el, pc, pc.LocalAddr(), addr)
85+
c := newUDPConn(el, pc, nil, pc.LocalAddr(), addr, nil)
8586
el.ch <- packUDPConn(c, buffer[:n])
8687
}
8788
}

0 commit comments

Comments
 (0)