make Send() generic with 'io.Writer'

This commit is contained in:
xdrm-brackets 2018-05-05 23:53:38 +02:00
parent 89124221fb
commit dadd3cd479
1 changed files with 2 additions and 2 deletions

View File

@ -149,7 +149,7 @@ func readMessage(reader io.Reader) (*Message, error){
// Send sends a frame over a socket
func (m Message) Send(socket net.Conn) error {
func (m Message) Send(writer io.Writer) error {
header := make([]byte, 0, maximumHeaderSize)
@ -190,7 +190,7 @@ func (m Message) Send(socket net.Conn) error {
writeBuf = append(writeBuf, m.Data[0:m.Size]...)
/* (4) Send over socket */
_, err := socket.Write(writeBuf)
_, err := writer.Write(writeBuf)
if err != nil { return err }
return nil