MCPcopy Create free account
hub / github.com/Hidden-Node/GooseRelayVPN-AndroidClient / EnqueueTx

Method EnqueueTx

internal/session/session.go:132–150  ·  view source on GitHub ↗

EnqueueTx appends bytes to the session's tx buffer. Blocks while the buffer exceeds TxBufHighWater. Safe to call concurrently with DrainTx.

(data []byte)

Source from the content-addressed store, hash-verified

130// EnqueueTx appends bytes to the session's tx buffer. Blocks while the buffer
131// exceeds TxBufHighWater. Safe to call concurrently with DrainTx.
132func (s *Session) EnqueueTx(data []byte) {
133 s.mu.Lock()
134 for len(s.txBuf) > TxBufHighWater && !s.closeReq {
135 s.txCond.Wait()
136 }
137 if s.closeReq {
138 s.mu.Unlock()
139 return
140 }
141 s.txBuf = append(s.txBuf, data...)
142 if s.firstQueuedAt.IsZero() {
143 s.firstQueuedAt = time.Now()
144 }
145 cb := s.OnTx
146 s.mu.Unlock()
147 if cb != nil {
148 cb()
149 }
150}
151
152// EnqueueInitialData appends data to the tx buffer while synNeeded is still
153// true, so the first DrainTx call bundles it into the SYN frame's payload

Calls

no outgoing calls