Update xdr; handle marshalling errors

This commit is contained in:
Jakob Borg
2014-10-21 08:40:05 +02:00
parent 1e915a2903
commit f2adfde1a8
16 changed files with 781 additions and 170 deletions

View File

@@ -126,7 +126,7 @@ type hdrMsg struct {
}
type encodable interface {
AppendXDR([]byte) []byte
AppendXDR([]byte) ([]byte, error)
}
const (
@@ -483,7 +483,11 @@ func (c *rawConnection) writerLoop() {
case hm := <-c.outbox:
if hm.msg != nil {
// Uncompressed message in uncBuf
uncBuf = hm.msg.AppendXDR(uncBuf[:0])
uncBuf, err = hm.msg.AppendXDR(uncBuf[:0])
if err != nil {
c.close(err)
return
}
if len(uncBuf) >= c.compressionThreshold {
// Use compression for large messages