summaryrefslogtreecommitdiff
path: root/lib/server/SocketListen.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/server/SocketListen.h')
-rw-r--r--lib/server/SocketListen.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/server/SocketListen.h b/lib/server/SocketListen.h
index 586adf22..635b15e8 100644
--- a/lib/server/SocketListen.h
+++ b/lib/server/SocketListen.h
@@ -87,12 +87,24 @@ public:
{
Close();
}
+<<<<<<< HEAD
+=======
+
+>>>>>>> 0.12
private:
SocketListen(const SocketListen &rToCopy)
{
}
+<<<<<<< HEAD
public:
+=======
+
+ int mType, mPort;
+ std::string mName;
+
+public:
+>>>>>>> 0.12
enum
{
MaxMultipleListenSockets = MaxMultiListenSockets
@@ -108,8 +120,13 @@ public:
if(::close(mSocketHandle) == -1)
#endif
{
+<<<<<<< HEAD
BOX_LOG_SYS_ERROR("Failed to close network "
"socket");
+=======
+ BOX_LOG_SOCKET_ERROR(mType, mName, mPort,
+ "Failed to close network socket");
+>>>>>>> 0.12
THROW_EXCEPTION(ServerException,
SocketCloseError)
}
@@ -127,6 +144,13 @@ public:
// ------------------------------------------------------------------
void Listen(Socket::Type Type, const char *Name, int Port = 0)
{
+<<<<<<< HEAD
+=======
+ mType = Type;
+ mName = Name;
+ mPort = Port;
+
+>>>>>>> 0.12
if(mSocketHandle != -1)
{
THROW_EXCEPTION(ServerException, SocketAlreadyOpen);
@@ -144,7 +168,12 @@ public:
0 /* let OS choose protocol */);
if(mSocketHandle == -1)
{
+<<<<<<< HEAD
BOX_LOG_SYS_ERROR("Failed to create a network socket");
+=======
+ BOX_LOG_SOCKET_ERROR(Type, Name, Port,
+ "Failed to create a network socket");
+>>>>>>> 0.12
THROW_EXCEPTION(ServerException, SocketOpenError)
}
@@ -158,7 +187,12 @@ public:
&option, sizeof(option)) == -1)
#endif
{
+<<<<<<< HEAD
BOX_LOG_SYS_ERROR("Failed to set socket options");
+=======
+ BOX_LOG_SOCKET_ERROR(Type, Name, Port,
+ "Failed to set socket options");
+>>>>>>> 0.12
THROW_EXCEPTION(ServerException, SocketOpenError)
}
@@ -166,10 +200,25 @@ public:
if(::bind(mSocketHandle, &addr.sa_generic, addrLen) == -1
|| ::listen(mSocketHandle, ListenBacklog) == -1)
{
+<<<<<<< HEAD
// Dispose of the socket
::close(mSocketHandle);
mSocketHandle = -1;
THROW_EXCEPTION(ServerException, SocketBindError)
+=======
+ int err_number = errno;
+
+ BOX_LOG_SOCKET_ERROR(Type, Name, Port,
+ "Failed to bind socket");
+
+ // Dispose of the socket
+ ::close(mSocketHandle);
+ mSocketHandle = -1;
+
+ THROW_SYS_FILE_ERRNO("Failed to bind or listen "
+ "on socket", Name, err_number,
+ ServerException, SocketBindError);
+>>>>>>> 0.12
}
}
@@ -222,7 +271,11 @@ public:
// signal?
if(errno == EINTR)
{
+<<<<<<< HEAD
BOX_ERROR("Failed to accept "
+=======
+ BOX_INFO("Failed to accept "
+>>>>>>> 0.12
"connection: interrupted by "
"signal");
// return nothing
@@ -230,8 +283,13 @@ public:
}
else
{
+<<<<<<< HEAD
BOX_LOG_SYS_ERROR("Failed to poll "
"connection");
+=======
+ BOX_LOG_SOCKET_ERROR(mType, mName, mPort,
+ "Failed to poll connection");
+>>>>>>> 0.12
THROW_EXCEPTION(ServerException,
SocketPollError)
}
@@ -250,7 +308,12 @@ public:
// Got socket (or error), unlock (implicit in destruction)
if(sock == -1)
{
+<<<<<<< HEAD
BOX_LOG_SYS_ERROR("Failed to accept connection");
+=======
+ BOX_LOG_SOCKET_ERROR(mType, mName, mPort,
+ "Failed to accept connection");
+>>>>>>> 0.12
THROW_EXCEPTION(ServerException, SocketAcceptError)
}