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

multiple session legs support #158

Merged
merged 4 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/tunnel/client/raw_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type rawSession struct {
closed bool
closedLock sync.RWMutex
log.Logger
remoteAddr net.Addr
}

// Creates a new client tunnel session with the given id
Expand All @@ -62,7 +63,7 @@ func NewRawSession(logger log.Logger, mux muxado.Session, heartbeatConfig *muxad
}

func newRawSession(mux muxado.Session, logger log.Logger, heartbeatConfig *muxado.HeartbeatConfig, handler SessionHandler) RawSession {
s := &rawSession{Logger: logger, handler: handler, latency: make(chan time.Duration)}
s := &rawSession{Logger: logger, handler: handler, latency: make(chan time.Duration), remoteAddr: mux.RemoteAddr()}
typed := muxado.NewTypedStreamSession(mux)
heart := muxado.NewHeartbeat(typed, s.onHeartbeat, heartbeatConfig)
s.mux = heart
Expand Down Expand Up @@ -164,6 +165,7 @@ func (s *rawSession) Accept() (netx.LoggedConn, error) {
}

reqType := proto.ReqType(raw.StreamType())
s.Debug("tunnel Accept", "reqType", reqType, "remoteAddr", s.remoteAddr)
deserialize := func(v any) (ok bool) {
if err := json.NewDecoder(raw).Decode(v); err != nil {
s.Error("failed to deserialize", "type", reflect.TypeOf(v), "err", err)
Expand Down
Loading
Loading