Skip to content

Commit

Permalink
Merge pull request #29 from ibuildthecloud/testing
Browse files Browse the repository at this point in the history
Add ability to set dialer in session
  • Loading branch information
ibuildthecloud authored Mar 18, 2021
2 parents 7e2ce2c + b7409d1 commit d1ebd52
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion readbuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (r *readBuffer) Read(b []byte) (int, error) {

for {
var (
n int
n int
err error
)

Expand Down
1 change: 0 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func (s *Server) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
session.auth = s.ClientConnectAuthorizer
defer s.sessions.remove(session)

// Don't need to associate req.Context() to the Session, it will cancel otherwise
code, err := session.Serve(req.Context())
if err != nil {
// Hijacked so we can't write to the client
Expand Down
5 changes: 5 additions & 0 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ func init() {
}

func NewClientSession(auth ConnectAuthorizer, conn *websocket.Conn) *Session {
return NewClientSessionWithDialer(auth, conn, nil)
}

func NewClientSessionWithDialer(auth ConnectAuthorizer, conn *websocket.Conn, dialer Dialer) *Session {
return &Session{
clientKey: "client",
conn: newWSConn(conn),
conns: map[int64]*connection{},
auth: auth,
client: true,
dialer: dialer,
}
}

Expand Down
8 changes: 4 additions & 4 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package remotedialer
import "time"

const (
PingWaitDuration = 60 * time.Second
PingWriteInterval = 5 * time.Second
MaxRead = 8192
HandshakeTimeOut = 10 * time.Second
PingWaitDuration = 60 * time.Second
PingWriteInterval = 5 * time.Second
MaxRead = 8192
HandshakeTimeOut = 10 * time.Second
)

0 comments on commit d1ebd52

Please sign in to comment.