Пример #1
0
func (mc *MatrixClient) Write(p *skn.Packet) {
	r := bytes.NewReader(p.Encode())
	mc.cond.L.Lock()
	if mc.conn == nil {
		mc.cond.Wait()
	}
	c := mc.conn
	mc.cond.L.Unlock()
	io.Copy(c, r)
}
Пример #2
0
func (ac *Agent) Write(p *skn.Packet) {
	data := p.Encode()
	io.Copy(ac.conn, bytes.NewReader(data))
}