socket.cc (12010:032f2717dfb7) socket.cc (12228:e78be19036e9)
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 92 unchanged lines hidden (view full) ---

101 if (::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&i,
102 sizeof(i)) < 0)
103 panic("ListenSocket(listen): setsockopt() SO_REUSEADDR failed!");
104 }
105
106 struct sockaddr_in sockaddr;
107 sockaddr.sin_family = PF_INET;
108 sockaddr.sin_addr.s_addr =
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 92 unchanged lines hidden (view full) ---

101 if (::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&i,
102 sizeof(i)) < 0)
103 panic("ListenSocket(listen): setsockopt() SO_REUSEADDR failed!");
104 }
105
106 struct sockaddr_in sockaddr;
107 sockaddr.sin_family = PF_INET;
108 sockaddr.sin_addr.s_addr =
109 htobe<unsigned long>(bindToLoopback ? INADDR_LOOPBACK : INADDR_ANY);
109 htobe<in_addr_t>(bindToLoopback ? INADDR_LOOPBACK : INADDR_ANY);
110 sockaddr.sin_port = htons(port);
111 // finally clear sin_zero
112 memset(&sockaddr.sin_zero, 0, sizeof(sockaddr.sin_zero));
113 int ret = ::bind(fd, (struct sockaddr *)&sockaddr, sizeof (sockaddr));
114 if (ret != 0) {
115 if (ret == -1 && errno != EADDRINUSE)
116 panic("ListenSocket(listen): bind() failed!");
117 return false;

--- 32 unchanged lines hidden ---
110 sockaddr.sin_port = htons(port);
111 // finally clear sin_zero
112 memset(&sockaddr.sin_zero, 0, sizeof(sockaddr.sin_zero));
113 int ret = ::bind(fd, (struct sockaddr *)&sockaddr, sizeof (sockaddr));
114 if (ret != 0) {
115 if (ret == -1 && errno != EADDRINUSE)
116 panic("ListenSocket(listen): bind() failed!");
117 return false;

--- 32 unchanged lines hidden ---