good morning!!!!

Skip to content
Snippets Groups Projects
Commit a2b96b63 authored by Thomas Guinther's avatar Thomas Guinther
Browse files

a

parent db627684
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ import (
type Handler interface {
// Handle will attempt to handle the Conn. Return io.EOF for normal disconnection or nil to continue to the next
// handle. The error will be relayed to the client so there is no need to send it yourself.
Handle(ctx context.Context, conn *fed.Conn) error
Handle(conn *fed.Conn) error
}
type CancellableHandler interface {
......
package google_cloud_sql
import (
"context"
"crypto/tls"
"fmt"
"net"
......@@ -101,7 +102,7 @@ func (T *Discoverer) instanceToCluster(primary *sqladmin.DatabaseInstance, repli
var admin *fed.Conn
defer func() {
if admin != nil {
_ = admin.Close()
_ = admin.Close(context.Background())
}
}()
......@@ -139,22 +140,23 @@ func (T *Discoverer) instanceToCluster(primary *sqladmin.DatabaseInstance, repli
var b flip.Bank
b.Queue(func() error {
return gsql.ExtendedQuery(inward, &result, "SELECT usename, passwd FROM pg_shadow WHERE usename=$1", user.Name)
return gsql.ExtendedQuery(context.Background(), inward, &result, "SELECT usename, passwd FROM pg_shadow WHERE usename=$1", user.Name)
})
b.Queue(func() error {
initialPacket, err := outward.ReadPacket(true)
ctx := context.Background()
initialPacket, err := outward.ReadPacket(ctx, true)
if err != nil {
return err
}
err, err2 := bouncers.Bounce(outward, admin, initialPacket)
err, err2 := bouncers.Bounce(ctx, outward, admin, initialPacket)
if err != nil {
return err
}
if err2 != nil {
return err2
}
return outward.Close()
return outward.Close(ctx)
})
if err = b.Wait(); err != nil {
......
......@@ -116,7 +116,7 @@ func (T *Server) Serve(ctx context.Context, conn *fed.Conn) {
if route.handle == nil {
continue
}
err := route.handle.Handle(ctx,conn)
err := route.handle.Handle(conn)
if err != nil {
if errors.Is(err, io.EOF) {
// normal closure
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment