all: Refactor relay invitations (#7646)

This commit is contained in:
Simon Frei
2021-05-10 22:25:43 +02:00
committed by GitHub
parent 6e662dc9fc
commit 713527facf
5 changed files with 38 additions and 44 deletions
+6 -1
View File
@@ -98,7 +98,12 @@ func (c *staticClient) serve(ctx context.Context) error {
if len(ip) == 0 || ip.IsUnspecified() {
msg.Address = remoteIPBytes(c.conn)
}
c.invitations <- msg
select {
case c.invitations <- msg:
case <-ctx.Done():
l.Debugln(c, "stopping")
return ctx.Err()
}
case protocol.RelayFull:
l.Infof("Disconnected from relay %s due to it becoming full.", c.uri)