Compare commits
3 Commits
5d5ee9c644
...
0fed1a2451
Author | SHA1 | Date | |
---|---|---|---|
0fed1a2451 | |||
9b89c47ecc | |||
32e7e09cc8 |
@ -37,6 +37,11 @@ func AdaptA(underlying net.Conn, party Party) Conn {
|
|||||||
transChan: make(chan *transA),
|
transChan: make(chan *transA),
|
||||||
done: make(chan struct { }),
|
done: make(chan struct { }),
|
||||||
}
|
}
|
||||||
|
if party == ClientSide {
|
||||||
|
conn.transID = 1
|
||||||
|
} else {
|
||||||
|
conn.transID = -1
|
||||||
|
}
|
||||||
go conn.receive()
|
go conn.receive()
|
||||||
return conn
|
return conn
|
||||||
}
|
}
|
||||||
@ -60,6 +65,7 @@ func (this *a) OpenTrans() (Trans, error) {
|
|||||||
id := this.transID
|
id := this.transID
|
||||||
this.transID ++
|
this.transID ++
|
||||||
trans := &transA {
|
trans := &transA {
|
||||||
|
parent: this,
|
||||||
id: id,
|
id: id,
|
||||||
incoming: usync.NewGate[incomingMessage](),
|
incoming: usync.NewGate[incomingMessage](),
|
||||||
}
|
}
|
||||||
|
@ -21,3 +21,10 @@ func (option Option[T]) Ok() bool {
|
|||||||
func (option Option[T]) Get() (T, bool) {
|
func (option Option[T]) Get() (T, bool) {
|
||||||
return (ucontainer.Optional[T])(option).Value()
|
return (ucontainer.Optional[T])(option).Value()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (option Option[T]) Default(defaul T) T {
|
||||||
|
if value, ok := option.Get(); ok {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
return defaul
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user