summaryrefslogtreecommitdiffstats
path: root/src/common.c
diff options
context:
space:
mode:
authorDavid Troy <dave@popvox.com>2006-04-04 19:39:39 +0000
committerDavid Troy <dave@popvox.com>2006-04-04 19:39:39 +0000
commite4b66ca5172292a09ac0f68b9373fcbe83cef8d6 (patch)
tree9d97f527917250cf6664470f899d5f0515e247ce /src/common.c
parentb93c5589c08ed90bb318557a32f7cae649727c1d (diff)
downloadastmanproxy-e4b66ca5172292a09ac0f68b9373fcbe83cef8d6.tar.gz
astmanproxy-e4b66ca5172292a09ac0f68b9373fcbe83cef8d6.tar.xz
astmanproxy-e4b66ca5172292a09ac0f68b9373fcbe83cef8d6.zip
git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/branches/1.20pre@79 f02b47b9-160a-0410-81a6-dc3441afb0ec
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/common.c b/src/common.c
index f4b370e..d6bea7a 100644
--- a/src/common.c
+++ b/src/common.c
@@ -102,60 +102,6 @@ const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia)
}
-int connect_nonb(int sockfd, const struct sockaddr *saptr, socklen_t salen, int nsec)
-{
- int flags, n, error;
- socklen_t len;
- fd_set rset, wset;
- struct timeval tval;
-
- flags = fcntl(sockfd, F_GETFL, 0);
- fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
-
- error = 0;
- if ( (n = connect(sockfd, (struct sockaddr *) saptr, salen)) < 0)
- if (errno != EINPROGRESS)
- return(-1);
-
- /* Do whatever we want while the connect is taking place. */
-
- if (n == 0)
- goto done; /* connect completed immediately */
-
- FD_ZERO(&rset);
- FD_SET(sockfd, &rset);
- wset = rset;
- tval.tv_sec = nsec;
- tval.tv_usec = 0;
-
- if ( (n = select(sockfd+1, &rset, &wset, NULL,
- nsec ? &tval : NULL)) == 0) {
- /*close(sockfd);*/ /* we want to retry */
- errno = ETIMEDOUT;
- return(-1);
- }
-
- if (FD_ISSET(sockfd, &rset) || FD_ISSET(sockfd, &wset)) {
- len = sizeof(error);
- if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &error, &len) < 0)
- return(-1); /* Solaris pending error */
- } else {
- /*err_quit("select error: sockfd not set");*/
- logmsg("select error: sockfd not set");
- return(-1);
- }
-
-done:
- fcntl(sockfd, F_SETFL, flags); /* restore file status flags */
-
- if (error) {
- /* close(sockfd); */ /* we want to retry... */
- errno = error;
- return(-1);
- }
- return(0);
-}
-
/*! If you are calling ast_carefulwrite, it is assumed that you are calling
it on a file descriptor that _DOES_ have NONBLOCK set. This way,
there is only one system call made to do a write, unless we actually