|
|
@@ -131,6 +131,8 @@ func (p *Peer) run() (remoteRequested bool, err error) {
|
|
|
)
|
|
|
|
|
|
p.wg.Add(2)
|
|
|
+ go p.readLoop(readErr)
|
|
|
+ go p.pingLoop()
|
|
|
|
|
|
writeStart <- struct{}{}
|
|
|
|
|
|
@@ -167,6 +169,16 @@ loop:
|
|
|
return remoteRequested, err
|
|
|
}
|
|
|
|
|
|
+func (p *Peer) readLoop(errc chan<- error) {
|
|
|
+ defer p.wg.Done()
|
|
|
+
|
|
|
+ // TODO 实现readLoop
|
|
|
+}
|
|
|
+
|
|
|
+func (p *Peer) pingLoop() {
|
|
|
+ // TODO 实现pingLoop
|
|
|
+}
|
|
|
+
|
|
|
type protoRW struct {
|
|
|
Protocol
|
|
|
in chan Msg // receives read messages
|