Skip to content

Commit

Permalink
close connection on EOF from client(issue #36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Omri Eival committed Jan 9, 2021
1 parent de07219 commit 0c2cdbf
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion cmd/expose.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"context"
"fmt"
"os"
"os/signal"
"strconv"
Expand Down Expand Up @@ -105,6 +106,6 @@ func init() {
exposeCmd.Flags().StringVarP(&Scheme, "scheme", "s", "tcp", "Connection scheme")
exposeCmd.Flags().StringVarP(&ServerHostOverride, "server-host-override", "o", "", "Server name use to verify the hostname returned by the TLS handshake")
exposeCmd.Flags().StringVarP(&Namespace, "namespace", "n", "default", "Namespace")
exposeCmd.Flags().StringVarP(&ServerImage, "server-image", "i", k8s.Image, "Ktunnel server image to use")
exposeCmd.Flags().StringVarP(&ServerImage, "server-image", "i", fmt.Sprintf("%s:%s", k8s.Image, version), "Ktunnel server image to use")
rootCmd.AddCommand(exposeCmd)
}
3 changes: 2 additions & 1 deletion cmd/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"context"
"fmt"
"os"
"os/signal"
"strconv"
Expand Down Expand Up @@ -120,7 +121,7 @@ func init() {
injectDeploymentCmd.Flags().StringVarP(&Scheme, "scheme", "s", "tcp", "Connection scheme")
injectDeploymentCmd.Flags().StringVarP(&ServerHostOverride, "server-host-override", "o", "", "Server name use to verify the hostname returned by the TLS handshake")
injectDeploymentCmd.Flags().StringVarP(&Namespace, "namespace", "n", "default", "Namespace")
injectDeploymentCmd.Flags().StringVarP(&ServerImage, "server-image", "i", k8s.Image, "Ktunnel server image to use")
injectDeploymentCmd.Flags().StringVarP(&ServerImage, "server-image", "i", fmt.Sprintf("%s:%s", k8s.Image, version), "Ktunnel server image to use")
injectCmd.AddCommand(injectDeploymentCmd)
rootCmd.AddCommand(injectCmd)
}
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

const (
version = "1.3.2"
version = "1.3.3b"
)

var port int
Expand Down
8 changes: 5 additions & 3 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,13 @@ loop:
return
default:
if err != nil {
if err == io.EOF {
break loop
if err != io.EOF {
conf.log.WithError(err).WithField("session", session.Id).Errorf("failed reading from socket")

} else {
conf.log.WithField("session", session.Id).Debugf("got EOF from connection")
}

conf.log.WithError(err).WithField("session", session.Id).Errorf("failed reading from socket")
session.Open = false
sessionsOut <- session
break loop
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
)

const (
Image = "quay.io/omrikiei/ktunnel:latest"
Image = "quay.io/omrikiei/ktunnel"
)

type ByCreationTime []apiv1.Pod
Expand Down

0 comments on commit 0c2cdbf

Please sign in to comment.