socket.cc (8229:78bf55f23338) socket.cc (10049:801519c624e4)
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;

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

98 sockaddr.sin_port = htons(port);
99 int ret = ::bind(fd, (struct sockaddr *)&sockaddr, sizeof (sockaddr));
100 if (ret != 0) {
101 if (ret == -1 && errno != EADDRINUSE)
102 panic("ListenSocket(listen): bind() failed!");
103 return false;
104 }
105
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;

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

98 sockaddr.sin_port = htons(port);
99 int ret = ::bind(fd, (struct sockaddr *)&sockaddr, sizeof (sockaddr));
100 if (ret != 0) {
101 if (ret == -1 && errno != EADDRINUSE)
102 panic("ListenSocket(listen): bind() failed!");
103 return false;
104 }
105
106 if (::listen(fd, 1) == -1)
107 panic("ListenSocket(listen): listen() failed!");
106 if (::listen(fd, 1) == -1) {
107 if (errno != EADDRINUSE)
108 panic("ListenSocket(listen): listen() failed!");
108
109
109 listening = true;
110 return false;
111 }
110
112
113 listening = true;
111 anyListening = true;
112 return true;
113}
114
115
116// Open a connection. Accept will block, so if you don't want it to,
117// make sure a connection is ready before you call accept.
118int

--- 12 unchanged lines hidden ---
114 anyListening = true;
115 return true;
116}
117
118
119// Open a connection. Accept will block, so if you don't want it to,
120// make sure a connection is ready before you call accept.
121int

--- 12 unchanged lines hidden ---