mirror of
https://github.com/rqlite/rqlite.git
synced 2026-01-25 04:16:26 +00:00
Add a Close() method to the tcp.Mux type (#2070)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
### Implementation changes and bug fixes
|
||||
- [PR #2064](https://github.com/rqlite/rqlite/pull/2064), [PR #2068](https://github.com/rqlite/rqlite/pull/2068): Add polling-based certificate file monitor.
|
||||
- [PR #2070](https://github.com/rqlite/rqlite/pull/2070): Add a `Close` method to the `tcp.Mux` type.
|
||||
|
||||
## v8.36.18 (April 19th 2025)
|
||||
There are no functional changes to rqlite in this release. The only changes are fixes for Docker image creation.
|
||||
|
||||
@@ -25,6 +25,7 @@ var (
|
||||
|
||||
func Test_ServiceExecute(t *testing.T) {
|
||||
ln, mux := mustNewMux()
|
||||
defer mux.Close()
|
||||
go mux.Serve()
|
||||
tn := mux.Listen(1) // Could be any byte value.
|
||||
db := mustNewMockDatabase()
|
||||
@@ -120,6 +121,7 @@ func Test_ServiceExecute(t *testing.T) {
|
||||
|
||||
func Test_ServiceQuery(t *testing.T) {
|
||||
ln, mux := mustNewMux()
|
||||
defer mux.Close()
|
||||
go mux.Serve()
|
||||
tn := mux.Listen(1) // Could be any byte value.
|
||||
db := mustNewMockDatabase()
|
||||
@@ -211,6 +213,7 @@ func Test_ServiceQuery(t *testing.T) {
|
||||
// encoded and decoded correctly.
|
||||
func Test_ServiceQueryLarge(t *testing.T) {
|
||||
ln, mux := mustNewMux()
|
||||
defer mux.Close()
|
||||
go mux.Serve()
|
||||
tn := mux.Listen(1) // Could be any byte value.
|
||||
db := mustNewMockDatabase()
|
||||
@@ -272,6 +275,7 @@ func Test_ServiceQueryLarge(t *testing.T) {
|
||||
|
||||
func Test_ServiceBackup(t *testing.T) {
|
||||
ln, mux := mustNewMux()
|
||||
defer mux.Close()
|
||||
go mux.Serve()
|
||||
tn := mux.Listen(1) // Could be any byte value.
|
||||
db := mustNewMockDatabase()
|
||||
@@ -319,6 +323,7 @@ func Test_ServiceBackup(t *testing.T) {
|
||||
|
||||
func Test_ServiceLoad(t *testing.T) {
|
||||
ln, mux := mustNewMux()
|
||||
defer mux.Close()
|
||||
go mux.Serve()
|
||||
tn := mux.Listen(1) // Could be any byte value.
|
||||
db := mustNewMockDatabase()
|
||||
@@ -366,6 +371,7 @@ func Test_ServiceLoad(t *testing.T) {
|
||||
|
||||
func Test_ServiceRemoveNode(t *testing.T) {
|
||||
ln, mux := mustNewMux()
|
||||
defer mux.Close()
|
||||
go mux.Serve()
|
||||
tn := mux.Listen(1) // Could be any byte value.
|
||||
db := mustNewMockDatabase()
|
||||
@@ -412,6 +418,7 @@ func Test_ServiceRemoveNode(t *testing.T) {
|
||||
|
||||
func Test_ServiceJoinNode(t *testing.T) {
|
||||
ln, mux := mustNewMux()
|
||||
defer mux.Close()
|
||||
go mux.Serve()
|
||||
tn := mux.Listen(1) // Could be any byte value.
|
||||
db := mustNewMockDatabase()
|
||||
@@ -469,6 +476,7 @@ func Test_ServiceJoinNodeForwarded(t *testing.T) {
|
||||
|
||||
// Create the Leader service.
|
||||
lnL, muxL := mustNewMux()
|
||||
defer muxL.Close()
|
||||
go muxL.Serve()
|
||||
tnL := muxL.Listen(headerByte)
|
||||
dbL := mustNewMockDatabase()
|
||||
@@ -487,6 +495,7 @@ func Test_ServiceJoinNodeForwarded(t *testing.T) {
|
||||
|
||||
// Create the Follower service.
|
||||
lnF, muxF := mustNewMux()
|
||||
defer muxF.Close()
|
||||
go muxF.Serve()
|
||||
tnF := muxF.Listen(headerByte)
|
||||
dbF := mustNewMockDatabase()
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
|
||||
func Test_NewServiceSetGetNodeAPIAddrMuxed(t *testing.T) {
|
||||
ln, mux := mustNewMux()
|
||||
defer mux.Close()
|
||||
go mux.Serve()
|
||||
tn := mux.Listen(1) // Could be any byte value.
|
||||
|
||||
@@ -49,6 +50,7 @@ func Test_NewServiceSetGetNodeAPIAddrMuxed(t *testing.T) {
|
||||
|
||||
func Test_NewServiceSetGetNodeAPIAddrMuxedTLS(t *testing.T) {
|
||||
ln, mux := mustNewTLSMux()
|
||||
defer mux.Close()
|
||||
go mux.Serve()
|
||||
tn := mux.Listen(1) // Could be any byte value.
|
||||
|
||||
|
||||
@@ -244,6 +244,7 @@ func main() {
|
||||
str.Stepdown(true)
|
||||
}
|
||||
muxLn.Close()
|
||||
defer mux.Close()
|
||||
|
||||
if err := str.Close(true); err != nil {
|
||||
log.Printf("failed to close store: %s", err.Error())
|
||||
|
||||
@@ -203,6 +203,13 @@ func (mux *Mux) Listen(header byte) net.Listener {
|
||||
return ln
|
||||
}
|
||||
|
||||
// Close closes the mux. It does not close any listeners created by the mux, nor
|
||||
// does it close the listener it was passed at creation time. It cleans up
|
||||
// other resources however.
|
||||
func (mux *Mux) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mux *Mux) handleConn(conn net.Conn) {
|
||||
stats.Add(numConnectionsHandled, 1)
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ func TestMux(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create mux: %s", err.Error())
|
||||
}
|
||||
defer mux.Close()
|
||||
mux.Timeout = 200 * time.Millisecond
|
||||
if !testing.Verbose() {
|
||||
mux.Logger = log.New(io.Discard, "", 0)
|
||||
@@ -137,6 +138,7 @@ func TestMux_Advertise(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create mux: %s", err.Error())
|
||||
}
|
||||
defer mux.Close()
|
||||
mux.Timeout = 200 * time.Millisecond
|
||||
if !testing.Verbose() {
|
||||
mux.Logger = log.New(io.Discard, "", 0)
|
||||
@@ -163,6 +165,7 @@ func TestMux_Listen_ErrAlreadyRegistered(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create mux: %s", err.Error())
|
||||
}
|
||||
defer mux.Close()
|
||||
mux.Listen(5)
|
||||
mux.Listen(5)
|
||||
}
|
||||
@@ -180,6 +183,7 @@ func TestTLSMux(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create mux: %s", err.Error())
|
||||
}
|
||||
defer mux.Close()
|
||||
go mux.Serve()
|
||||
|
||||
// Verify that the listener is secured.
|
||||
|
||||
Reference in New Issue
Block a user