code: func (c *BaseConn) Send(pkt packet.Generic, async bool) error {
  	c.sMutex.Lock()
  	defer c.sMutex.Unlock()
  
  	// write packet
  	err := c.stream.Write(pkt, async)
  	if err != nil {
  		// ensure connection gets closed
  		_ = c.carrier.Close()
  
  		return err
  	}
  
  	return nil
  }
docs: // Send will write the packet to an internal buffer. It will either flush the
  // internal buffer immediately or asynchronously in the background when it gets
  // stale. Encoding errors are directly returned, but any network errors caught
  // while flushing the buffer asynchronously will be returned on the next call.
  //
  // Note: Only one goroutine can Send at the same time.