summaryrefslogtreecommitdiffhomepage
path: root/server/fsm.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/fsm.go')
-rw-r--r--server/fsm.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/server/fsm.go b/server/fsm.go
index 6b033060..42f2005a 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -21,6 +21,7 @@ import (
"github.com/osrg/gobgp/config"
"github.com/osrg/gobgp/packet"
"gopkg.in/tomb.v2"
+ "io"
"net"
"time"
)
@@ -327,12 +328,9 @@ func buildopen(global *config.Global, peerConf *config.Neighbor) *bgp.BGPMessage
func readAll(conn net.Conn, length int) ([]byte, error) {
buf := make([]byte, length)
- for cur := 0; cur < length; {
- if num, err := conn.Read(buf); err != nil {
- return nil, err
- } else {
- cur += num
- }
+ _, err := io.ReadFull(conn, buf)
+ if err != nil {
+ return nil, err
}
return buf, nil
}