mirror of https://github.com/cbeuw/Cloak
Store stream in packet receive path instead of asynchronously to fix https://github.com/cbeuw/Cloak/issues/74
This commit is contained in:
parent
bdd5308169
commit
d35472aea1
|
|
@ -124,7 +124,6 @@ func (sesh *Session) Accept() (net.Conn, error) {
|
||||||
if stream == nil {
|
if stream == nil {
|
||||||
return nil, ErrBrokenSession
|
return nil, ErrBrokenSession
|
||||||
}
|
}
|
||||||
sesh.streams.Store(stream.id, stream)
|
|
||||||
log.Tracef("stream %v of session %v accepted", stream.id, sesh.id)
|
log.Tracef("stream %v of session %v accepted", stream.id, sesh.id)
|
||||||
return stream, nil
|
return stream, nil
|
||||||
}
|
}
|
||||||
|
|
@ -200,6 +199,7 @@ func (sesh *Session) recvDataFromRemote(data []byte) error {
|
||||||
connId, _, _ := sesh.sb.pickRandConn()
|
connId, _, _ := sesh.sb.pickRandConn()
|
||||||
// we ignore the error here. If the switchboard is broken, it will be reflected upon stream.Write
|
// we ignore the error here. If the switchboard is broken, it will be reflected upon stream.Write
|
||||||
stream := makeStream(sesh, frame.StreamID, connId)
|
stream := makeStream(sesh, frame.StreamID, connId)
|
||||||
|
sesh.streams.Store(stream.id, stream)
|
||||||
sesh.acceptCh <- stream
|
sesh.acceptCh <- stream
|
||||||
return stream.writeFrame(*frame)
|
return stream.writeFrame(*frame)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue