From fcd31883f145c6e7bb3dd2bfe69ed530beaf8acf Mon Sep 17 00:00:00 2001 From: persan Date: Tue, 22 Mar 2016 21:45:36 +0100 Subject: [PATCH] Marked obsolete things obsolete and validated the multithreadet server. --- examples/zmq-examples-multi_thread_server.adb | 13 +++++++------ libzeromq/README.md | 5 +++++ src/zmq-proxys.adb | 6 ++++-- src/zmq-sockets.ads | 9 ++++++--- 4 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 libzeromq/README.md diff --git a/examples/zmq-examples-multi_thread_server.adb b/examples/zmq-examples-multi_thread_server.adb index 3f738e9..4ccab33 100644 --- a/examples/zmq-examples-multi_thread_server.adb +++ b/examples/zmq-examples-multi_thread_server.adb @@ -57,18 +57,19 @@ begin -- Initialise 0MQ context, requesting a single application thread -- and a single I/O thread Ctx.Set_Number_Of_IO_Threads (Servers'Length + 1); - -- Create a ZMQ_REP socket to receive requests and send replies - Workers.Initialize (Ctx, Sockets.XREQ); - Workers.Bind ("inproc://workers"); + Workers.Initialize (Ctx, Sockets.ROUTER); + Workers.Bind ("tcp://lo:5555"); -- Bind to the TCP transport and port 5555 on the 'lo' interface - Clients.Initialize (Ctx, Sockets.XREP); - Workers.Bind ("tcp://lo:5555"); + Clients.Initialize (Ctx, Sockets.DEALER); + Clients.Bind ("inproc://workers"); for I in Servers'Range loop Servers (I) := new Server_Task (Ctx'Access, I); end loop; - ZMQ.Proxys.Proxy (Frontend => Workers'Access, Backend => Clients'Access); + + ZMQ.Proxys.Proxy (Frontend => Clients'Access, + Backend => Workers'Access); end ZMQ.Examples.Multi_Thread_Server; diff --git a/libzeromq/README.md b/libzeromq/README.md new file mode 100644 index 0000000..c2d21c0 --- /dev/null +++ b/libzeromq/README.md @@ -0,0 +1,5 @@ +This folder contains build scripts to install zeromq and libsodium +if the distrubution doesent provide a compatibel version of zmq or +a compiler different from the distrubutions is used. + + diff --git a/src/zmq-proxys.adb b/src/zmq-proxys.adb index 16cf232..47fac15 100644 --- a/src/zmq-proxys.adb +++ b/src/zmq-proxys.adb @@ -31,8 +31,9 @@ with ZMQ.Low_Level; with Interfaces.C; use Interfaces.C; +with System; use System; package body ZMQ.Proxys is - + -- ----------- -- Proxy -- ----------- @@ -46,7 +47,8 @@ package body ZMQ.Proxys is pragma Unreferenced (Dummy); begin Dummy := ZMQ.Low_Level.Zmq_Proxy - (Frontend.Get_Impl, Backend.Get_Impl, Capture.Get_Impl); + (Frontend.Get_Impl, Backend.Get_Impl, + (if Capture /= null then Capture.Get_Impl else System.Null_Address)); end Proxy; end ZMQ.Proxys; diff --git a/src/zmq-sockets.ads b/src/zmq-sockets.ads index c41f9dd..d674df8 100644 --- a/src/zmq-sockets.ads +++ b/src/zmq-sockets.ads @@ -44,14 +44,17 @@ package ZMQ.Sockets is SUB, REQ, REP, - XREQ, - XREP, + DEALER, + ROUTER, PULL, PUSH, XPUB, XSUB, STREAM); - + XREQ : constant Socket_Type := DEALER; + pragma Obsolescent (XREQ, "use DEALER"); + XREP : constant Socket_Type := ROUTER; + pragma Obsolescent (XREP, "use ROUTER"); type Socket is new Ada.Finalization.Limited_Controlled with private; type Any_Socket is access all Socket'Class;