-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsession.go
29 lines (26 loc) · 890 Bytes
/
session.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package gosm
import "time"
func (original *Component) ForkComponent(session State) *Component {
component := &Component{
ports: original.ports,
stateCharts: []State{session},
timer: time.NewTimer(receiveTimeout),
stopped: false,
active: true,
}
original.ports.addListeningComponent(original, component)
/*
// Clone all the ports from the original component
for lp := range original.ports.Outgoing {
portConnector(&component.ports, original.ports.Outgoing[lp].Listener, original.ports.Outgoing[lp].From, original.ports.Outgoing[lp].To)
}
for _, ip := range original.ports.Internal {
component.ports.Internal = append(component.ports.Internal, ip)
ip.Listeners = append(ip.Listeners, &component.ports)
}
*/
return component
}
func (original *Component) LaunchSession(session *Component) {
original.Runtime.startComponent(session)
}