Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Margot yoba branch #47

Closed

Conversation

margothequeen
Copy link
Contributor

adding interconnection

@@ -1,2 +1,5 @@
vendor
devbin/*
go1.22.4.linux-amd64.tar.gz
yezzey.log
examples/yproxy.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

examples/yproxy.yaml definitely shouldn't persist here, as this file is committed into repo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also go1.22.4.linux-amd64.tar.gz is not needed here

Comment on lines +117 to +158
go func() {

listener, err := net.Listen("unix", instanceCnf.InterconnectSocketPath)

ylogger.Zero.Debug().Msg("try to start interconnect socket listener")
if err != nil {
ylogger.Zero.Error().Err(err).Msg("failed to start interconnect socket listener")
return
}
defer listener.Close()

for {
clConn, err := listener.Accept()
if err != nil {
ylogger.Zero.Error().Err(err).Msg("failed to accept interconnection")
continue
}
ylogger.Zero.Debug().Str("addr", clConn.LocalAddr().String()).Msg("accepted client interconnection")

ycl := client.NewYClient(clConn)
r := proc.NewProtoReader(ycl)

mt, _, err := r.ReadPacket()

if err != nil {
ylogger.Zero.Error().Err(err).Msg("failed to accept interconnection")
continue
}

switch mt {
case message.MessageTypeGool:
msg := message.ReadyForQueryMessage{}
_, _ = ycl.GetRW().Write(msg.Encode())
default:
ycl.ReplyError(fmt.Errorf("wrong message type"), "")

}

clConn.Close()
ylogger.Zero.Debug().Msg("interconnection closed")
}
}()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is now can be done using i.DispatchServer utility

@reshke reshke closed this Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants