derp: sprinkle comments and docstrings.

Signed-off-by: David Anderson <dave@natulte.net>
pull/203/head
David Anderson 5 years ago committed by Dave Anderson
parent 58b8ebd290
commit 64b5248929

@ -51,11 +51,11 @@ type Server struct {
packetsRecv, bytesRecv expvar.Int packetsRecv, bytesRecv expvar.Int
packetsDropped expvar.Int packetsDropped expvar.Int
packetsDroppedReason metrics.LabelMap packetsDroppedReason metrics.LabelMap
packetsDroppedUnknown *expvar.Int packetsDroppedUnknown *expvar.Int // unknown dst pubkey
packetsDroppedGone *expvar.Int packetsDroppedGone *expvar.Int // dst conn shutting down
packetsDroppedQueueHead *expvar.Int packetsDroppedQueueHead *expvar.Int // queue full, drop head packet
packetsDroppedQueueTail *expvar.Int packetsDroppedQueueTail *expvar.Int // queue full, drop tail packet
packetsDroppedWrite *expvar.Int packetsDroppedWrite *expvar.Int // error writing to dst conn
accepts expvar.Int accepts expvar.Int
curClients expvar.Int curClients expvar.Int
curHomeClients expvar.Int // ones with preferred curHomeClients expvar.Int // ones with preferred
@ -486,7 +486,7 @@ type sclient struct {
type pkt struct { type pkt struct {
src key.Public src key.Public
bs []byte bs []byte // pkt owns backing array
// TODO(danderson): enqueue time, to measure queue latency? // TODO(danderson): enqueue time, to measure queue latency?
} }
@ -587,6 +587,10 @@ func (c *sclient) sendKeepalive() error {
return c.bw.Flush() return c.bw.Flush()
} }
// sendPacket writes contents to the client in a RecvPacket frame. If
// srcKey.IsZero, uses the old DERPv1 framing format, otherwise uses
// DERPv2. The bytes of contents are only valid until this function
// returns, do not retain slices.
func (c *sclient) sendPacket(srcKey key.Public, contents []byte) (err error) { func (c *sclient) sendPacket(srcKey key.Public, contents []byte) (err error) {
defer func() { defer func() {
// Stats update. // Stats update.

Loading…
Cancel
Save