forked from cwtch.im/cwtch
Review Board Comments #2
This commit is contained in:
parent
815ec2565b
commit
37b9c72abb
|
@ -101,7 +101,7 @@ func (e *engine) eventHandler() {
|
|||
case event.StatusRequest:
|
||||
e.eventManager.Publish(event.Event{EventType: event.ProtocolEngineStatus, EventID: ev.EventID})
|
||||
case event.PeerRequest:
|
||||
e.peerWithOnion(ev.Data[event.RemotePeer])
|
||||
go e.peerWithOnion(ev.Data[event.RemotePeer])
|
||||
case event.InvitePeerToGroup:
|
||||
e.sendMessageToPeer(ev.EventID, ev.Data[event.RemotePeer], event.ContextInvite, []byte(ev.Data[event.GroupInvite]))
|
||||
case event.JoinServer:
|
||||
|
@ -160,8 +160,13 @@ func (e *engine) Shutdown() {
|
|||
}
|
||||
|
||||
// peerWithOnion is the entry point for cwtchPeer relationships
|
||||
// needs to be run in a goroutine as will block on Open.
|
||||
func (e *engine) peerWithOnion(onion string) {
|
||||
e.service.Connect(onion, e.createPeerTemplate())
|
||||
e.ignoreOnShutdown(e.peerConnecting)(onion)
|
||||
_,err := e.service.Connect(onion, e.createPeerTemplate())
|
||||
if err != nil {
|
||||
e.ignoreOnShutdown(e.peerDisconnected)(onion)
|
||||
}
|
||||
}
|
||||
|
||||
func (e * engine) ignoreOnShutdown(f func(string)) func(string){
|
||||
|
|
|
@ -40,11 +40,6 @@ func (pa PeerApp) NewInstance() tapir.Application {
|
|||
// Init is run when the connection is first started.
|
||||
func (pa *PeerApp) Init(connection *tapir.Connection) {
|
||||
|
||||
// We don't want to issue an event for unknown peers (we only know inbound peer hostnames once we have authenticated)
|
||||
if connection.Outbound {
|
||||
pa.OnConnecting(connection.Hostname)
|
||||
}
|
||||
|
||||
// First run the Authentication App
|
||||
pa.AuthApp.Init(connection)
|
||||
|
||||
|
|
Loading…
Reference in New Issue