func setUDPRecvBuf(c *net.UDPConn) {
	size := udpRecvBuf
	for {
		if err := c.SetReadBuffer(size); err == nil {
			break
		}
		size = size / 2
	}
}
setUDPRecvBuf is used to resize the UDP receive window. The function
attempts to set the read buffer to `udpRecvBuf` but backs off until
the read buffer can be set.
package memberlist
import (
	"bufio"
	"bytes"
	"encoding/binary"
	"fmt"
	"io"
	"net"
	"time"
	"github.com/socketplane/socketplane/Godeps/_workspace/src/github.com/armon/go-metrics"
	"github.com/socketplane/socketplane/Godeps/_workspace/src/github.com/hashicorp/go-msgpack/codec"
)
const (
	ProtocolVersionMin uint8 = 1
	ProtocolVersionMax       = 2
)
type messageType uint8
const (
	pingMsg messageType = iota
	indirectPingMsg
	ackRespMsg
	suspectMsg
	aliveMsg
	deadMsg
	pushPullMsg
	compoundMsg
	userMsg  
	compressMsg
	encryptMsg
)
type compressionType uint8
const (
	lzwAlgo compressionType = iota
)
const (
	MetaMaxSize            = 512  
	compoundHeaderOverhead = 2    
	compoundOverhead       = 2    
	udpBufSize             = 65536
	udpRecvBuf             = 2 * 1024 * 1024
	udpSendBuf             = 1400
	userMsgOverhead        = 1
	blockingWarning        = 10 * time.Millisecond  
	maxPushStateBytes      = 10 * 1024 * 1024
)
type ping struct {
	SeqNo uint32
	Node string
}
type indirectPingReq struct {
	SeqNo  uint32
	Target []byte
	Port   uint16
	Node   string
}
type ackResp struct {
	SeqNo uint32
}
type suspect struct {
	Incarnation uint32
	Node        string
	From        string  
}
type alive struct {
	Incarnation uint32
	Node        string
	Addr        []byte
	Port        uint16
	Meta        []byte
	Vsn []uint8
}
type dead struct {
	Incarnation uint32
	Node        string
	From        string  
}
type pushPullHeader struct {
	Nodes        int
	UserStateLen int   
	Join         bool  
}
type pushNodeState struct {
	Name        string
	Addr        []byte
	Port        uint16
	Meta        []byte
	Incarnation uint32
	State       nodeStateType
	Vsn         []uint8  
}
type compress struct {
	Algo compressionType
	Buf  []byte
}
type msgHandoff struct {
	msgType messageType
	buf     []byte
	from    net.Addr
}
func (m *Memberlist) encryptionVersion() encryptionVersion {
	switch m.ProtocolVersion() {
	case 1:
		return 0
	default:
		return 1
	}
}