Marked obsolete things obsolete and validated the multithreadet server.

This commit is contained in:
persan 2016-03-22 21:45:36 +01:00
parent a24e4aa64a
commit fcd31883f1
4 changed files with 22 additions and 11 deletions

View File

@ -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;

5
libzeromq/README.md Normal file
View File

@ -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.

View File

@ -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;

View File

@ -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;