Add eventUpstreamConnected
This is used in the next commit.
This commit is contained in:
parent
977a1b294f
commit
dd13e1cb62
7
user.go
7
user.go
@ -14,6 +14,10 @@ type eventUpstreamMessage struct {
|
|||||||
uc *upstreamConn
|
uc *upstreamConn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type eventUpstreamConnected struct {
|
||||||
|
uc *upstreamConn
|
||||||
|
}
|
||||||
|
|
||||||
type eventUpstreamDisconnected struct {
|
type eventUpstreamDisconnected struct {
|
||||||
uc *upstreamConn
|
uc *upstreamConn
|
||||||
}
|
}
|
||||||
@ -75,6 +79,7 @@ func (net *network) run() {
|
|||||||
net.conn = uc
|
net.conn = uc
|
||||||
net.lock.Unlock()
|
net.lock.Unlock()
|
||||||
|
|
||||||
|
net.user.events <- eventUpstreamConnected{uc}
|
||||||
if err := uc.readMessages(net.user.events); err != nil {
|
if err := uc.readMessages(net.user.events); err != nil {
|
||||||
uc.logger.Printf("failed to handle messages: %v", err)
|
uc.logger.Printf("failed to handle messages: %v", err)
|
||||||
}
|
}
|
||||||
@ -167,6 +172,8 @@ func (u *user) run() {
|
|||||||
|
|
||||||
for e := range u.events {
|
for e := range u.events {
|
||||||
switch e := e.(type) {
|
switch e := e.(type) {
|
||||||
|
case eventUpstreamConnected:
|
||||||
|
// Nothing to do
|
||||||
case eventUpstreamDisconnected:
|
case eventUpstreamDisconnected:
|
||||||
uc := e.uc
|
uc := e.uc
|
||||||
for _, log := range uc.logs {
|
for _, log := range uc.logs {
|
||||||
|
Loading…
Reference in New Issue
Block a user