(buffers [][]byte)
| 114 | } |
| 115 | |
| 116 | func (peer *Peer) SendBuffers(buffers [][]byte) error { |
| 117 | peer.device.net.RLock() |
| 118 | defer peer.device.net.RUnlock() |
| 119 | |
| 120 | if peer.device.isClosed() { |
| 121 | return nil |
| 122 | } |
| 123 | |
| 124 | peer.endpoint.Lock() |
| 125 | endpoint := peer.endpoint.val |
| 126 | if endpoint == nil { |
| 127 | peer.endpoint.Unlock() |
| 128 | return errors.New("no known endpoint for peer") |
| 129 | } |
| 130 | if peer.endpoint.clearSrcOnTx { |
| 131 | endpoint.ClearSrc() |
| 132 | peer.endpoint.clearSrcOnTx = false |
| 133 | } |
| 134 | peer.endpoint.Unlock() |
| 135 | |
| 136 | err := peer.device.net.bind.Send(buffers, endpoint) |
| 137 | if err == nil { |
| 138 | var totalLen uint64 |
| 139 | for _, b := range buffers { |
| 140 | totalLen += uint64(len(b)) |
| 141 | } |
| 142 | peer.txBytes.Add(totalLen) |
| 143 | } |
| 144 | return err |
| 145 | } |
| 146 | |
| 147 | func (peer *Peer) String() string { |
| 148 | // The awful goo that follows is identical to: |
no test coverage detected