Commit bf5cc691 authored by hannahhoward's avatar hannahhoward

fix(sessions): minor cleanup

remove for loop not needed, cleanup spelling
parent 40aa1fb8
......@@ -18,7 +18,7 @@ import (
const activeWantsLimit = 16
// SessionWantmanager is an interface that can be used to request blocks
// SessionWantManager is an interface that can be used to request blocks
// from given peers.
type SessionWantManager interface {
WantBlocks(ctx context.Context, ks []cid.Cid, peers []peer.ID, ses uint64)
......
......@@ -49,16 +49,12 @@ func (sm *SessionManager) NewSession(ctx context.Context) exchange.Fetcher {
sm.sessions = append(sm.sessions, session)
sm.sessLk.Unlock()
go func() {
for {
defer cancel()
select {
case <-sm.ctx.Done():
sm.removeSession(session)
return
case <-ctx.Done():
sm.removeSession(session)
return
}
defer cancel()
select {
case <-sm.ctx.Done():
sm.removeSession(session)
case <-ctx.Done():
sm.removeSession(session)
}
}()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment