Skip to content

Commit

Permalink
Adding wstunsrv
Browse files Browse the repository at this point in the history
  • Loading branch information
rshade committed Oct 17, 2024
1 parent 609b506 commit 9e51ee1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5.0.2
with:
go-version: '1.22'

cache: true
cache-dependency-path: go.sum
- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
11 changes: 2 additions & 9 deletions tunnel/wstunsrv.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ type remoteServer struct {
requestSet map[int16]*remoteRequest // all requests in queue/flight indexed by ID
requestSetMutex sync.Mutex
log log15.Logger
readMutex sync.Mutex // ensure that no more than one goroutine calls the websocket read methods concurrently
readCond *sync.Cond // (NextReader, SetReadDeadline, SetPingHandler, ...)
readMutex sync.Mutex // ensure that no more than one goroutine calls the websocket read methods concurrently
readCond *sync.Cond // (NextReader, SetReadDeadline, SetPingHandler, ...)
}

// WSTunnelServer a wstunnel server construct
Expand Down Expand Up @@ -351,12 +351,6 @@ func getResponse(t *WSTunnelServer, req *remoteRequest, w http.ResponseWriter, r
}

// Ensure we retire the request when we pop out of this function
<<<<<<< HEAD
// and release the lock on reading new requests
defer func() {
rs.RetireRequest(req)
rs.readCond.Signal()
=======
// and signal the tunnel reader to continue
defer func() {
rs.RetireRequest(req)
Expand All @@ -365,7 +359,6 @@ func getResponse(t *WSTunnelServer, req *remoteRequest, w http.ResponseWriter, r
rs.readCond.Signal()
rs.readCond.L.Unlock()
}
>>>>>>> mporsch/fix-sync-waitgroup-reused-2
}()

// enqueue request
Expand Down

0 comments on commit 9e51ee1

Please sign in to comment.