X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=jcc.c;h=83d1eceaf088cbf812585f2d4c7813dd37cedb45;hp=53de19a607b4ca16450e2307b83f9877edbbef18;hb=97f02b9084390150f7640c4f84fe0fedf924a767;hpb=1419e9ec40a3fe80e2c9685f37a081b031db7cf1 diff --git a/jcc.c b/jcc.c index 53de19a6..83d1ecea 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.421 2012/12/07 12:50:37 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.426 2014/06/02 06:19:06 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -6,7 +6,7 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.421 2012/12/07 12:50:37 fabiankeil Exp $" * Purpose : Main file. Contains main() method, main loop, and * the main connection-handling function. * - * Copyright : Written by and Copyright (C) 2001-2012 the + * Copyright : Written by and Copyright (C) 2001-2014 the * Privoxy team. http://www.privoxy.org/ * * Based on the Internet Junkbuster originally written @@ -182,6 +182,10 @@ privoxy_mutex_t log_mutex; privoxy_mutex_t log_init_mutex; privoxy_mutex_t connection_reuse_mutex; +#ifdef FEATURE_EXTERNAL_FILTERS +privoxy_mutex_t external_filter_mutex; +#endif + #if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R) privoxy_mutex_t resolver_mutex; #endif /* !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R) */ @@ -3134,6 +3138,9 @@ static void initialize_mutexes(void) privoxy_mutex_init(&log_mutex); privoxy_mutex_init(&log_init_mutex); privoxy_mutex_init(&connection_reuse_mutex); +#ifdef FEATURE_EXTERNAL_FILTERS + privoxy_mutex_init(&external_filter_mutex); +#endif /* * XXX: The assumptions below are a bit naive @@ -3518,6 +3525,13 @@ int main(int argc, char **argv) close(fd); } +#ifdef FEATURE_EXTERNAL_FILTERS + for (fd = 0; fd < 3; fd++) + { + mark_socket_for_close_on_execute(fd); + } +#endif + chdir("/"); } /* -END- if (daemon_mode) */ @@ -3643,7 +3657,7 @@ int main(int argc, char **argv) * on failure. * * Parameters : - * 1 : haddr = Host addres to bind to. Use NULL to bind to + * 1 : haddr = Host address to bind to. Use NULL to bind to * INADDR_ANY. * 2 : hport = Specifies port to bind to. * @@ -3682,6 +3696,15 @@ static jb_socket bind_port_helper(const char *haddr, int hport) return JB_INVALID_SOCKET; } +#ifndef _WIN32 + if (bfd >= FD_SETSIZE) + { + log_error(LOG_LEVEL_FATAL, + "Bind socket number too high to use select(): %d >= %d", + bfd, FD_SETSIZE); + } +#endif + if (haddr == NULL) { log_error(LOG_LEVEL_INFO, "Listening on port %d on all IP addresses",