~ubuntu-branches/ubuntu/saucy/uwsgi/saucy

« back to all changes in this revision

Viewing changes to socket.c

  • Committer: Package Import Robot
  • Author(s): Janos Guljas
  • Date: 2012-04-30 17:35:22 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120430173522-qucwu1au3s9bflhb
Tags: 1.2+dfsg-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
758
758
        return serverfd;
759
759
}
760
760
 
 
761
// set non-blocking socket
761
762
void uwsgi_socket_nb(int fd) {
762
763
        int arg;
763
764
 
774
775
 
775
776
}
776
777
 
 
778
// set blocking socket
 
779
void uwsgi_socket_b(int fd) {
 
780
        int arg;
 
781
 
 
782
        arg = fcntl(fd, F_GETFL, NULL);
 
783
        if (arg < 0) {
 
784
                uwsgi_error("fcntl()");
 
785
                return;
 
786
        }
 
787
        arg &= (~O_NONBLOCK);
 
788
        if (fcntl(fd, F_SETFL, arg) < 0) {
 
789
                uwsgi_error("fcntl()");
 
790
                return;
 
791
        }
 
792
 
 
793
}
 
794
 
 
795
 
777
796
int timed_connect(struct pollfd *fdpoll, const struct sockaddr *addr, int addr_size, int timeout, int async) {
778
797
 
779
798
        int arg, ret;
1013
1032
        union uwsgi_sockaddr usa;
1014
1033
        int abstract = 0;
1015
1034
 
1016
 
#ifdef UWSGI_DEBUG
1017
 
        uwsgi_log("creating socket from fd %d\n", fd);
1018
 
#endif
1019
 
 
1020
1035
        socket_type_len = sizeof(struct sockaddr_un);
1021
1036
        gsa.sa = &usa.sa;
1022
1037
        if (!getsockname(fd, gsa.sa, &socket_type_len)) {