File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -119,18 +119,26 @@ func portInUse(hostPort string) bool {
119
119
return false
120
120
}
121
121
122
- func updateSystemVariables (cfg mysql.ListenerConfig ) error {
122
+ func getPortOrDefault (cfg mysql.ListenerConfig ) int64 {
123
+ // TODO read this values from systemVars
124
+ defaultPort := int64 (3606 )
123
125
_ , port , err := net .SplitHostPort (cfg .Listener .Addr ().String ())
124
126
if err != nil {
125
- return err
127
+ return defaultPort
126
128
}
127
129
portInt , err := strconv .ParseInt (port , 10 , 64 )
128
130
if err != nil {
129
- return err
131
+ return defaultPort
130
132
}
133
+ return portInt
134
+ }
135
+
136
+ func updateSystemVariables (cfg mysql.ListenerConfig ) error {
137
+ port := getPortOrDefault (cfg )
138
+
131
139
// TODO: add the rest of the config variables
132
- err = sql .SystemVariables .AssignValues (map [string ]interface {}{
133
- "port" : portInt ,
140
+ err : = sql .SystemVariables .AssignValues (map [string ]interface {}{
141
+ "port" : port ,
134
142
"max_connections" : cfg .MaxConns ,
135
143
"net_read_timeout" : cfg .ConnReadTimeout .Seconds (),
136
144
"net_write_timeout" : cfg .ConnWriteTimeout .Seconds (),
Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ import (
18
18
gsql "github.com/dolthub/go-mysql-server/sql"
19
19
)
20
20
21
- // TestSeverCustomListener verifies a caller can provide their own net.Conn implementation for the server to use
22
- func TestSeverCustomListener (t * testing.T ) {
21
+ // TestServerCustomListener verifies a caller can provide their own net.Conn implementation for the server to use
22
+ func TestServerCustomListener (t * testing.T ) {
23
23
dbName := "mydb"
24
24
// create a net.Conn thats based on a golang buffer
25
25
buffer := 1024
You can’t perform that action at this time.
0 commit comments