Selaa lähdekoodia

准备实现pingLoop

skyfffire 2 vuotta sitten
vanhempi
commit
76ce06c25d
1 muutettua tiedostoa jossa 12 lisäystä ja 0 poistoa
  1. 12 0
      p2p/peer.go

+ 12 - 0
p2p/peer.go

@@ -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