Changeset 3066 for box/trunk/lib
- Timestamp:
- 22/01/2012 16:32:07 (4 months ago)
- Location:
- box/trunk/lib/server
- Files:
-
- 2 edited
-
SocketListen.h (modified) (8 diffs)
-
SocketStream.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/lib/server/SocketListen.h
r3034 r3066 88 88 Close(); 89 89 } 90 90 91 private: 91 92 SocketListen(const SocketListen &rToCopy) 92 93 { 93 94 } 95 96 int mType, mPort; 97 std::string mName; 98 94 99 public: 95 96 100 enum 97 101 { … … 109 113 #endif 110 114 { 111 BOX_LOG_S YS_ERROR("Failed to close network "112 " socket");115 BOX_LOG_SOCKET_ERROR(mType, mName, mPort, 116 "Failed to close network socket"); 113 117 THROW_EXCEPTION(ServerException, 114 118 SocketCloseError) … … 128 132 void Listen(Socket::Type Type, const char *Name, int Port = 0) 129 133 { 134 mType = Type; 135 mName = Name; 136 mPort = Port; 137 130 138 if(mSocketHandle != -1) 131 139 { … … 145 153 if(mSocketHandle == -1) 146 154 { 147 BOX_LOG_SYS_ERROR("Failed to create a network socket"); 155 BOX_LOG_SOCKET_ERROR(Type, Name, Port, 156 "Failed to create a network socket"); 148 157 THROW_EXCEPTION(ServerException, SocketOpenError) 149 158 } … … 159 168 #endif 160 169 { 161 BOX_LOG_SYS_ERROR("Failed to set socket options"); 170 BOX_LOG_SOCKET_ERROR(Type, Name, Port, 171 "Failed to set socket options"); 162 172 THROW_EXCEPTION(ServerException, SocketOpenError) 163 173 } … … 168 178 { 169 179 int err_number = errno; 180 181 BOX_LOG_SOCKET_ERROR(Type, Name, Port, 182 "Failed to bind socket"); 183 170 184 // Dispose of the socket 171 185 ::close(mSocketHandle); 172 186 mSocketHandle = -1; 187 173 188 THROW_SYS_FILE_ERRNO("Failed to bind or listen " 174 189 "on socket", Name, err_number, … … 234 249 else 235 250 { 236 BOX_LOG_S YS_ERROR("Failed to poll "237 " connection");251 BOX_LOG_SOCKET_ERROR(mType, mName, mPort, 252 "Failed to poll connection"); 238 253 THROW_EXCEPTION(ServerException, 239 254 SocketPollError) … … 254 269 if(sock == -1) 255 270 { 256 BOX_LOG_SYS_ERROR("Failed to accept connection"); 271 BOX_LOG_SOCKET_ERROR(mType, mName, mPort, 272 "Failed to accept connection"); 257 273 THROW_EXCEPTION(ServerException, SocketAcceptError) 258 274 } -
box/trunk/lib/server/SocketStream.cpp
r2451 r3066 155 155 SocketAllAddr addr; 156 156 int addrLen = 0; 157 Socket::NameLookupToSockAddr(addr, sockDomain, Type, rName, Port, addrLen); 157 Socket::NameLookupToSockAddr(addr, sockDomain, Type, rName, Port, 158 addrLen); 158 159 159 160 // Create the socket … … 162 163 if(mSocketHandle == INVALID_SOCKET_VALUE) 163 164 { 164 BOX_LOG_SYS_ERROR("Failed to create a network socket"); 165 BOX_LOG_SOCKET_ERROR(Type, rName, Port, 166 "Failed to create a network socket"); 165 167 THROW_EXCEPTION(ServerException, SocketOpenError) 166 168 } … … 170 172 { 171 173 // Dispose of the socket 174 BOX_LOG_SOCKET_ERROR(Type, rName, Port, 175 "Failed to connect to socket"); 172 176 #ifdef WIN32 173 DWORD err = WSAGetLastError();174 177 ::closesocket(mSocketHandle); 175 BOX_LOG_WIN_ERROR_NUMBER("Failed to connect to socket "176 "(type " << Type << ", name " << rName <<177 ", port " << Port << ")", err);178 178 #else // !WIN32 179 BOX_LOG_SYS_ERROR("Failed to connect to socket (type " <<180 Type << ", name " << rName << ", port " << Port <<181 ")");182 179 ::close(mSocketHandle); 183 180 #endif // WIN32
Note: See TracChangeset
for help on using the changeset viewer.
