diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2023-06-05 13:05:10 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2023-06-05 13:05:10 +0200 |
commit | 3dfbd4d089c9181f8980d530933a47114b8c5656 (patch) | |
tree | a4bada4230e1b41855f178d25d967cc8e5a2aabb /internal/imap/client.go | |
parent | 980e34f491cd1f00609ec81a7f113185b92a62dd (diff) | |
download | feed2imap-go-3dfbd4d089c9181f8980d530933a47114b8c5656.tar.gz feed2imap-go-3dfbd4d089c9181f8980d530933a47114b8c5656.tar.bz2 feed2imap-go-3dfbd4d089c9181f8980d530933a47114b8c5656.zip |
IMAP client does not need to know about max number of connections
Diffstat (limited to '')
-rw-r--r-- | internal/imap/client.go | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/internal/imap/client.go b/internal/imap/client.go index 4a0a0d8..5d36373 100644 --- a/internal/imap/client.go +++ b/internal/imap/client.go @@ -21,13 +21,12 @@ type connConf struct { type Client struct { connConf - mailboxes *mailboxes - commander *commander - connections []*connection - maxConnections int - connChannel chan *connection - connLock sync.Mutex - disconnected bool + mailboxes *mailboxes + commander *commander + connections []*connection + connChannel chan *connection + connLock sync.Mutex + disconnected bool } var dialer imapClient.Dialer @@ -105,10 +104,6 @@ func (cl *Client) Disconnect() { func (cl *Client) createConnection(c *imapClient.Client) *connection { - if len(cl.connections) == cl.maxConnections { - panic("Too many connections") - } - client := &client{c, uidplus.NewClient(c)} conn := &connection{ @@ -121,11 +116,9 @@ func (cl *Client) createConnection(c *imapClient.Client) *connection { return conn } -func newClient(maxConnections int) *Client { +func newClient() *Client { return &Client{ - mailboxes: NewMailboxes(), - connChannel: make(chan *connection, 0), - connections: make([]*connection, 0, maxConnections), - maxConnections: maxConnections, + mailboxes: NewMailboxes(), + connChannel: make(chan *connection, 0), } } |