/* support for multiple socket connections */
static CONNECTION *Connections = NULL;
-/* forward declarations */
-static int socket_preconnect (void);
-static int socket_connect (int fd, struct sockaddr *sa);
-static CONNECTION *socket_new_conn (void);
-
/* Wrappers */
int mutt_socket_open (CONNECTION * conn)
{
- if (socket_preconnect ())
- return -1;
+ int rc;
+
+ if (m_strlen(Preconnect)) {
+ rc = mutt_system (Preconnect);
+ if (rc) {
+ mutt_perror (_("Preconnect command failed."));
+ mutt_sleep (1);
+ return -1;
+ }
+ }
- return conn->conn_open (conn);
+ return conn->conn_open(conn);
}
int mutt_socket_close (CONNECTION * conn)
conn = conn->next;
}
- conn = socket_new_conn ();
+ conn = p_new(CONNECTION, 1);
+ conn->fd = -1;
conn->account = *account;
-
- conn->next = Connections;
+ conn->next = Connections;
Connections = conn;
if (Tunnel && *Tunnel)
return conn;
}
-static int socket_preconnect (void)
-{
- int rc;
- int save_errno;
-
- if (m_strlen(Preconnect)) {
- rc = mutt_system (Preconnect);
- if (rc) {
- save_errno = errno;
- mutt_perror (_("Preconnect command failed."));
- mutt_sleep (1);
-
- return save_errno;
- }
- }
-
- return 0;
-}
-
/* socket_connect: set up to connect to a socket fd. */
static int socket_connect (int fd, struct sockaddr *sa)
{
return save_errno;
}
-/* socket_new_conn: allocate and initialise a new connection. */
-static CONNECTION *socket_new_conn (void)
-{
- CONNECTION *conn;
-
- conn = p_new(CONNECTION, 1);
- conn->fd = -1;
-
- return conn;
-}
-
int raw_socket_close (CONNECTION * conn)
{
return close (conn->fd);