mirror of
https://github.com/FluuxIO/go-xmpp
synced 2024-11-05 12:00:50 +00:00
Comments clean-up
This commit is contained in:
parent
0227596f90
commit
1d7db9ceee
@ -4,9 +4,9 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// Config & TransportConfiguration must not be modified after having been passed to NewClient. Any
|
||||
// changes made after connecting are ignored.
|
||||
type Config struct {
|
||||
// TransportConfiguration must not be modified after having been passed to NewClient. Any
|
||||
// changes made after connecting are ignored.
|
||||
TransportConfiguration
|
||||
|
||||
Jid string
|
||||
|
@ -19,21 +19,21 @@ func newStreamLogger(conn io.ReadWriter, logFile io.Writer) io.ReadWriter {
|
||||
}
|
||||
}
|
||||
|
||||
func (sp *streamLogger) Read(p []byte) (n int, err error) {
|
||||
n, err = sp.socket.Read(p)
|
||||
func (sl *streamLogger) Read(p []byte) (n int, err error) {
|
||||
n, err = sl.socket.Read(p)
|
||||
if n > 0 {
|
||||
sp.logFile.Write([]byte("RECV:\n")) // Prefix
|
||||
if n, err := sp.logFile.Write(p[:n]); err != nil {
|
||||
sl.logFile.Write([]byte("RECV:\n")) // Prefix
|
||||
if n, err := sl.logFile.Write(p[:n]); err != nil {
|
||||
return n, err
|
||||
}
|
||||
sp.logFile.Write([]byte("\n\n")) // Separator
|
||||
sl.logFile.Write([]byte("\n\n")) // Separator
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (sp *streamLogger) Write(p []byte) (n int, err error) {
|
||||
sp.logFile.Write([]byte("SEND:\n")) // Prefix
|
||||
for _, w := range []io.Writer{sp.socket, sp.logFile} {
|
||||
func (sl *streamLogger) Write(p []byte) (n int, err error) {
|
||||
sl.logFile.Write([]byte("SEND:\n")) // Prefix
|
||||
for _, w := range []io.Writer{sl.socket, sl.logFile} {
|
||||
n, err = w.Write(p)
|
||||
if err != nil {
|
||||
return
|
||||
@ -43,7 +43,7 @@ func (sp *streamLogger) Write(p []byte) (n int, err error) {
|
||||
return
|
||||
}
|
||||
}
|
||||
sp.logFile.Write([]byte("\n\n")) // Separator
|
||||
sl.logFile.Write([]byte("\n\n")) // Separator
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
var ErrTransportProtocolNotSupported = errors.New("Transport protocol not supported")
|
||||
var ErrTLSNotSupported = errors.New("Transport does not support StartTLS")
|
||||
|
||||
// TODO: rename to transport config?
|
||||
type TransportConfiguration struct {
|
||||
// Address is the XMPP Host and port to connect to. Host is of
|
||||
// the form 'serverhost:port' i.e "localhost:8888"
|
||||
|
Loading…
Reference in New Issue
Block a user