Update outboundconn.go

add 10s timeout for handshake and add onStatus feedback for OUTBOUND_CONN_STATUS_HANDSHAKE_OK
This commit is contained in:
hy05190134
2016-04-20 11:54:16 +08:00
parent d3e2d6c506
commit abd754d0cc

View File

@@ -92,7 +92,7 @@ func Dial(url string, handler OutboundConnHandler, maxChannelNumber int) (Outbou
}
br := bufio.NewReader(c)
bw := bufio.NewWriter(c)
timeout := time.Duration(0)
timeout := time.Duration(10*time.Second)
err = Handshake(c, br, bw, timeout)
//err = HandshakeSample(c, br, bw, timeout)
if err == nil {
@@ -106,6 +106,7 @@ func Dial(url string, handler OutboundConnHandler, maxChannelNumber int) (Outbou
transactions: make(map[uint32]string),
streams: make(map[uint32]OutboundStream),
}
obConn.handler.OnStatus(obConn)
obConn.conn = NewConn(c, br, bw, obConn, maxChannelNumber)
return obConn, nil
}