code: func (c *channel) writePacket(packet []byte) error {
  	c.writeMu.Lock()
  	if c.sentClose {
  		c.writeMu.Unlock()
  		return io.EOF
  	}
  	c.sentClose = (packet[0] == msgChannelClose)
  	err := c.mux.conn.writePacket(packet)
  	c.writeMu.Unlock()
  	return err
  }
docs: // writePacket sends a packet. If the packet is a channel close, it updates
  // sentClose. This method takes the lock c.writeMu.