Skip to content

Commit

Permalink
Fix / improve code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mremond committed Feb 13, 2016
1 parent e29241b commit 4d34634
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions xmpp/client.go
Expand Up @@ -22,7 +22,10 @@ type Client struct {
Setting up the client / Checking the parameters
*/

// TODO: better options check
// NewClient generates a new XMPP client, based on Options passed as parameters.
// If host is not specified, the DNS SRV should be used to find the host from the domainpart of the JID.
// Default the port to 5222.
// TODO: better options checks
func NewClient(options Options) (c *Client, err error) {
// TODO: If option address is nil, use the Jid domain to compose the address
if options.Address, err = checkAddress(options.Address); err != nil {
Expand Down Expand Up @@ -62,9 +65,7 @@ func checkAddress(addr string) (string, error) {
return strings.Join([]string{hostport[0], "5222"}, ":"), err
}

// NewClient creates a new connection to a host given as "hostname" or "hostname:port".
// If host is not specified, the DNS SRV should be used to find the host from the domainpart of the JID.
// Default the port to 5222.
// Connect triggers actual TCP connection, based on previously defined parameters.
func (c *Client) Connect() (*Session, error) {
var tcpconn net.Conn
var err error
Expand Down Expand Up @@ -98,7 +99,8 @@ func (c *Client) recv(receiver chan<- interface{}) (err error) {
panic("unreachable")
}

// Channel allow client to receive / dispatch packets in for range loop
// Recv abstracts receiving preparsed XMPP packets from a channel.
// Channel allow client to receive / dispatch packets in for range loop.
func (c *Client) Recv() <-chan interface{} {
ch := make(chan interface{})
go c.recv(ch)
Expand Down

0 comments on commit 4d34634

Please sign in to comment.