mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-20 22:31:33 +02:00
Problem: formatting inconsistent
Solution: applied clang-format
This commit is contained in:
@@ -29,22 +29,22 @@
|
||||
|
||||
#include "testutil.hpp"
|
||||
|
||||
#if defined (ZMQ_HAVE_WINDOWS)
|
||||
# include <winsock2.h>
|
||||
# include <stdexcept>
|
||||
#if defined(ZMQ_HAVE_WINDOWS)
|
||||
#include <winsock2.h>
|
||||
#include <stdexcept>
|
||||
#else
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
# include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined (ZMQ_HAVE_WINDOWS)
|
||||
#if defined(ZMQ_HAVE_WINDOWS)
|
||||
|
||||
void initialise_network (void)
|
||||
{
|
||||
WSADATA info;
|
||||
if (WSAStartup(MAKEWORD(2,0), &info) != 0)
|
||||
throw std::runtime_error("Could not start WSA");
|
||||
if (WSAStartup (MAKEWORD (2, 0), &info) != 0)
|
||||
throw std::runtime_error ("Could not start WSA");
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -68,31 +68,34 @@ int main (void)
|
||||
assert (ctx);
|
||||
void *dealer = zmq_socket (ctx, ZMQ_DEALER);
|
||||
if (zmq_bind (dealer, "tcp://127.0.0.1:*") == -1) {
|
||||
printf ("E: Cannot find 127.0.0.1 -- your system does not have local\n");
|
||||
printf ("E: networking. Please fix this before running libzmq checks.\n");
|
||||
printf (
|
||||
"E: Cannot find 127.0.0.1 -- your system does not have local\n");
|
||||
printf (
|
||||
"E: networking. Please fix this before running libzmq checks.\n");
|
||||
return -1;
|
||||
}
|
||||
// Check that we can create 1,000 sockets
|
||||
int handle [1000];
|
||||
int handle[1000];
|
||||
int count;
|
||||
for (count = 0; count < 1000; count++) {
|
||||
handle [count] = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (handle [count] == -1) {
|
||||
handle[count] = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (handle[count] == -1) {
|
||||
printf ("W: Only able to create %d sockets on this box\n", count);
|
||||
printf ("I: Tune your system to increase maximum allowed file handles\n");
|
||||
#if defined (ZMQ_HAVE_OSX)
|
||||
printf (
|
||||
"I: Tune your system to increase maximum allowed file handles\n");
|
||||
#if defined(ZMQ_HAVE_OSX)
|
||||
printf ("I: On OS/X, run 'ulimit -n 1200' in bash\n");
|
||||
#elif defined (ZMQ_HAVE_LINUX)
|
||||
#elif defined(ZMQ_HAVE_LINUX)
|
||||
printf ("I: On Linux, run 'ulimit -n 1200' in bash\n");
|
||||
#endif
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// Release the socket handles
|
||||
for (count = 0; count < 1000; count++) {
|
||||
close(handle[count]);
|
||||
close (handle[count]);
|
||||
}
|
||||
|
||||
zmq_close(dealer);
|
||||
zmq_ctx_term(ctx);
|
||||
zmq_close (dealer);
|
||||
zmq_ctx_term (ctx);
|
||||
}
|
||||
|
Reference in New Issue
Block a user