From b582c444f876cf50866fefdd70cf88357fd87f3a Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sat, 24 Aug 2019 01:57:08 -0500 Subject: [PATCH] minor cleanup --- src/yggdrasil/conn.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/yggdrasil/conn.go b/src/yggdrasil/conn.go index 18c0b880..2f69139e 100644 --- a/src/yggdrasil/conn.go +++ b/src/yggdrasil/conn.go @@ -158,18 +158,13 @@ func (c *Conn) _getDeadlineCancellation(t *time.Time) (util.Cancellation, bool) } // SetReadCallback sets a callback which will be called whenever a packet is received. -// Note that calls to Read will fail if the callback has been set to a non-nil value. func (c *Conn) SetReadCallback(callback func([]byte)) { c.EnqueueFrom(nil, func() { - c._setReadCallback(callback) + c.readCallback = callback + c._drainReadBuffer() }) } -func (c *Conn) _setReadCallback(callback func([]byte)) { - c.readCallback = callback - c._drainReadBuffer() -} - func (c *Conn) _drainReadBuffer() { if c.readCallback == nil { return