merged node and traffic packages
This commit is contained in:
@@ -9,25 +9,25 @@ import (
|
||||
"git-indra.lan/indra-labs/indra/pkg/util/slice"
|
||||
)
|
||||
|
||||
func (en *Engine) forward(on *forward.Layer, b slice.Bytes,
|
||||
func (eng *Engine) forward(on *forward.Layer, b slice.Bytes,
|
||||
c *slice.Cursor, prev types.Onion) {
|
||||
|
||||
// forward the whole buffer received onwards. Usually there will be a
|
||||
// crypt.Layer under this which will be unwrapped by the receiver.
|
||||
if on.AddrPort.String() == en.Node.AddrPort.String() {
|
||||
if on.AddrPort.String() == eng.Node.AddrPort.String() {
|
||||
// it is for us, we want to unwrap the next part.
|
||||
en.handleMessage(BudgeUp(b, *c), on)
|
||||
eng.handleMessage(BudgeUp(b, *c), on)
|
||||
} else {
|
||||
switch on1 := prev.(type) {
|
||||
case *crypt.Layer:
|
||||
sess := en.FindSessionByHeader(on1.ToPriv)
|
||||
sess := eng.FindSessionByHeader(on1.ToPriv)
|
||||
if sess != nil {
|
||||
en.DecSession(sess.ID,
|
||||
en.RelayRate*lnwire.MilliSatoshi(len(b))/1024/1024,
|
||||
eng.DecSession(sess.ID,
|
||||
eng.RelayRate*lnwire.MilliSatoshi(len(b))/1024/1024,
|
||||
false, "forward")
|
||||
}
|
||||
}
|
||||
// we need to forward this message onion.
|
||||
en.Send(on.AddrPort, b)
|
||||
eng.Send(on.AddrPort, b)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user