equal
deleted
inserted
replaced
61 // This loop is paused until resource binding is complete. Otherwise |
61 // This loop is paused until resource binding is complete. Otherwise |
62 // the app might inject something inappropriate into our negotiations |
62 // the app might inject something inappropriate into our negotiations |
63 // with the server. The control channel controls this loop's |
63 // with the server. The control channel controls this loop's |
64 // activity. |
64 // activity. |
65 func writeStream(srvOut chan<- interface{}, cliIn <-chan Stanza, |
65 func writeStream(srvOut chan<- interface{}, cliIn <-chan Stanza, |
66 control <-chan int) { |
66 control <-chan sendCmd) { |
67 defer close(srvOut) |
67 defer close(srvOut) |
68 |
68 |
69 var input <-chan Stanza |
69 var input <-chan Stanza |
70 Loop: |
70 Loop: |
71 for { |
71 for { |
72 select { |
72 select { |
73 case status := <-control: |
73 case cmd := <-control: |
74 switch status { |
74 switch cmd { |
75 case 0: |
75 case sendDeny: |
76 input = nil |
76 input = nil |
77 case 1: |
77 case sendAllow: |
78 input = cliIn |
78 input = cliIn |
79 case -1: |
|
80 break Loop |
|
81 } |
79 } |
82 case x, ok := <-input: |
80 case x, ok := <-input: |
83 if !ok { |
81 if !ok { |
84 break Loop |
82 break Loop |
85 } |
83 } |