Compare commits
2 Commits
540c64a421
...
5e885a0bd3
Author | SHA1 | Date | |
---|---|---|---|
5e885a0bd3 | |||
659bcecbe6 |
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module git.tebibyte.media/sashakoshka/hopp
|
||||
go 1.23.0
|
||||
|
||||
require (
|
||||
git.tebibyte.media/sashakoshka/go-util v0.9.0
|
||||
git.tebibyte.media/sashakoshka/go-util v0.9.1
|
||||
github.com/gomarkdown/markdown v0.0.0-20241205020045-f7e15b2f3e62
|
||||
github.com/quic-go/quic-go v0.48.2
|
||||
)
|
||||
|
4
go.sum
4
go.sum
@ -1,5 +1,5 @@
|
||||
git.tebibyte.media/sashakoshka/go-util v0.9.0 h1:s4u6USI1yRqTFNv52qJlEy1qO9pfF2+U6IklxkSLckY=
|
||||
git.tebibyte.media/sashakoshka/go-util v0.9.0/go.mod h1:0Q1t+PePdx6tFYkRuJNcpM1Mru7wE6X+it1kwuOH+6Y=
|
||||
git.tebibyte.media/sashakoshka/go-util v0.9.1 h1:eGAbLwYhOlh4aq/0w+YnJcxT83yPhXtxnYMzz6K7xGo=
|
||||
git.tebibyte.media/sashakoshka/go-util v0.9.1/go.mod h1:0Q1t+PePdx6tFYkRuJNcpM1Mru7wE6X+it1kwuOH+6Y=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
|
16
metadapta.go
16
metadapta.go
@ -102,7 +102,7 @@ func (this *a) receive() {
|
||||
defer func() {
|
||||
this.underlying.Close()
|
||||
this.transLock.Lock()
|
||||
defer this.transLock.Lock()
|
||||
defer this.transLock.Unlock()
|
||||
for _, trans := range this.transMap {
|
||||
trans.Close()
|
||||
}
|
||||
@ -124,22 +124,30 @@ func (this *a) receive() {
|
||||
}
|
||||
|
||||
func (this *a) receiveMultiplex(transID int64, method uint16, payload []byte) error {
|
||||
if transID == 0 || this.party == partyFromTransID(transID) {
|
||||
return ErrMessageMalformed
|
||||
}
|
||||
if transID == 0 { return ErrMessageMalformed }
|
||||
|
||||
trans, err := func() (*transA, error) {
|
||||
this.transLock.Lock()
|
||||
defer this.transLock.Unlock()
|
||||
|
||||
trans, ok := this.transMap[transID]
|
||||
if !ok {
|
||||
// it is forbidden for the other party to initiate a transaction
|
||||
// with an ID from this party
|
||||
if this.party == partyFromTransID(transID) {
|
||||
return nil, ErrMessageMalformed
|
||||
}
|
||||
trans = &transA {
|
||||
parent: this,
|
||||
id: transID,
|
||||
incoming: usync.NewGate[incomingMessage](),
|
||||
}
|
||||
this.transMap[transID] = trans
|
||||
this.transChan <- trans
|
||||
}
|
||||
return trans, nil
|
||||
}()
|
||||
if err != nil { return err }
|
||||
|
||||
trans.incoming.Send(incomingMessage {
|
||||
method: method,
|
||||
|
Loading…
Reference in New Issue
Block a user