summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2013-06-10 11:47:29 -0700
committerAlan Antonuk <alan.antonuk@gmail.com>2013-06-13 15:47:29 -0700
commitf027518d5d4cd5ba231fd45d3ae40679f17752f6 (patch)
treefb72e7a729b55669f157261b256fce102dec431f
parentf2094209844d44d7d6c6e7ce8328747acbb1ef1e (diff)
downloadrabbitmq-c-f027518d5d4cd5ba231fd45d3ae40679f17752f6.tar.gz
Return error on socket lib init failure
Winsock2 requires calling a function to initialize the socket library. This call can fail. Return an error code to the user if it does.
-rw-r--r--librabbitmq/amqp.h3
-rw-r--r--librabbitmq/win32/socket.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/librabbitmq/amqp.h b/librabbitmq/amqp.h
index 05f096b..e5099ff 100644
--- a/librabbitmq/amqp.h
+++ b/librabbitmq/amqp.h
@@ -345,6 +345,9 @@ typedef enum amqp_status_enum_
AMQP_STATUS_TABLE_TOO_BIG = -0x000B,
AMQP_STATUS_WRONG_METHOD = -0x000C,
+ AMQP_STATUS_TCP_ERROR = -0x0100,
+ AMQP_STATUS_TCP_SOCKETLIB_INIT_ERROR = -0x0101,
+
AMQP_STATUS_SSL_ERROR = -0x0200
} amqp_status_enum;
diff --git a/librabbitmq/win32/socket.c b/librabbitmq/win32/socket.c
index 8b44c25..aaadfbb 100644
--- a/librabbitmq/win32/socket.c
+++ b/librabbitmq/win32/socket.c
@@ -56,7 +56,7 @@ amqp_socket_init(void)
WSADATA data;
int res = WSAStartup(0x0202, &data);
if (res) {
- return AMQP_STATUS_SOCKET_ERROR;
+ return AMQP_STATUS_TCP_SOCKETLIB_INIT_ERROR;
}
called_wsastartup = 1;