MCPcopy Create free account
hub / github.com/encodeous/nylon / SendKeepalive

Method SendKeepalive

polyamide/device/send.go:81–96  ·  view source on GitHub ↗

* Queues a keepalive if no packets are queued for peer */

()

Source from the content-addressed store, hash-verified

79/* Queues a keepalive if no packets are queued for peer
80 */
81func (peer *Peer) SendKeepalive() {
82 if len(peer.queue.staged) == 0 && peer.isRunning.Load() {
83 elem := peer.device.NewOutboundElement()
84 elemsContainer := peer.device.GetOutboundElementsContainer()
85 elemsContainer.elems = append(elemsContainer.elems, elem)
86 select {
87 case peer.queue.staged <- elemsContainer:
88 peer.device.Log.Verbosef("%v - Sending keepalive packet", peer)
89 default:
90 peer.device.PutMessageBuffer(elem.buffer)
91 peer.device.PutOutboundElement(elem)
92 peer.device.PutOutboundElementsContainer(elemsContainer)
93 }
94 }
95 peer.SendStagedPackets()
96}
97
98func (peer *Peer) SendHandshakeInitiation(isRetry bool) error {
99 if !isRetry {

Callers 7

upLockedMethod · 0.80
handlePostConfigMethod · 0.80
RoutineHandshakeMethod · 0.80
expiredSendKeepaliveFunction · 0.80

Calls 6

SendStagedPacketsMethod · 0.95
NewOutboundElementMethod · 0.80
PutMessageBufferMethod · 0.80
PutOutboundElementMethod · 0.80

Tested by

no test coverage detected