164 } |
164 } |
165 |
165 |
166 // Start the transport handler, initially unencrypted. |
166 // Start the transport handler, initially unencrypted. |
167 recvReader, recvWriter := io.Pipe() |
167 recvReader, recvWriter := io.Pipe() |
168 sendReader, sendWriter := io.Pipe() |
168 sendReader, sendWriter := io.Pipe() |
169 go cl.readTransport(recvWriter) |
169 go cl.recvTransport(recvWriter) |
170 go cl.writeTransport(sendReader) |
170 go cl.sendTransport(sendReader) |
171 |
171 |
172 // Start the reader and writer that convert to and from XML. |
172 // Start the reader and writer that convert to and from XML. |
173 recvXml := make(chan interface{}) |
173 recvXmlCh := make(chan interface{}) |
174 go readXml(recvReader, recvXml, extStanza) |
174 go recvXml(recvReader, recvXmlCh, extStanza) |
175 sendXml := make(chan interface{}) |
175 sendXmlCh := make(chan interface{}) |
176 cl.sendXml = sendXml |
176 cl.sendXml = sendXmlCh |
177 go writeXml(sendWriter, sendXml) |
177 go sendXml(sendWriter, sendXmlCh) |
178 |
178 |
179 // Start the reader and writer that convert between XML and |
179 // Start the reader and writer that convert between XML and |
180 // XMPP stanzas. |
180 // XMPP stanzas. |
181 recvRawXmpp := make(chan Stanza) |
181 recvRawXmpp := make(chan Stanza) |
182 go cl.readStream(recvXml, recvRawXmpp) |
182 go cl.recvStream(recvXmlCh, recvRawXmpp) |
183 sendRawXmpp := make(chan Stanza) |
183 sendRawXmpp := make(chan Stanza) |
184 go writeStream(sendXml, sendRawXmpp, cl.inputControl) |
184 go sendStream(sendXmlCh, sendRawXmpp, cl.inputControl) |
185 |
185 |
186 // Start the manager for the filters that can modify what the |
186 // Start the manager for the filters that can modify what the |
187 // app sees. |
187 // app sees. |
188 recvFiltXmpp := make(chan Stanza) |
188 recvFiltXmpp := make(chan Stanza) |
189 cl.Recv = recvFiltXmpp |
189 cl.Recv = recvFiltXmpp |