aboutsummaryrefslogtreecommitdiff
path: root/networking/httpd.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-11-22 23:22:06 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-11-22 23:22:06 +0000
commit48237b0c88343154d58854020c3a9c8b07c61b10 (patch)
treeb36bc84f22dd797b45c8d665e50e2f6c690e1370 /networking/httpd.c
parentb40bdb383a6b7a7f0fd36d0b1cc24deb42cd5f0d (diff)
downloadbusybox-w32-48237b0c88343154d58854020c3a9c8b07c61b10.tar.gz
busybox-w32-48237b0c88343154d58854020c3a9c8b07c61b10.tar.bz2
busybox-w32-48237b0c88343154d58854020c3a9c8b07c61b10.zip
introduce setsockopt_reuseaddr(int fd), setsockopt_broadcast(int fd),
use them where appropriate. 200 bytes saved
Diffstat (limited to 'networking/httpd.c')
-rw-r--r--networking/httpd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index b82e9f995..97b04fb03 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -802,7 +802,6 @@ static int openServer(void)
802{ 802{
803 struct sockaddr_in lsocket; 803 struct sockaddr_in lsocket;
804 int fd; 804 int fd;
805 int on = 1;
806 805
807 /* create the socket right now */ 806 /* create the socket right now */
808 /* inet_addr() returns a value that is already in network order */ 807 /* inet_addr() returns a value that is already in network order */
@@ -814,9 +813,13 @@ static int openServer(void)
814 /* tell the OS it's OK to reuse a previous address even though */ 813 /* tell the OS it's OK to reuse a previous address even though */
815 /* it may still be in a close down state. Allows bind to succeed. */ 814 /* it may still be in a close down state. Allows bind to succeed. */
816#ifdef SO_REUSEPORT 815#ifdef SO_REUSEPORT
817 setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, (void *)&on, sizeof(on)); 816 {
817 static const int on = 1;
818 setsockopt(fd, SOL_SOCKET, SO_REUSEPORT,
819 (void *)&on, sizeof(on));
820 }
818#else 821#else
819 setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on)); 822 setsockopt_reuseaddr(fd);
820#endif 823#endif
821 xbind(fd, (struct sockaddr *)&lsocket, sizeof(lsocket)); 824 xbind(fd, (struct sockaddr *)&lsocket, sizeof(lsocket));
822 xlisten(fd, 9); 825 xlisten(fd, 9);