1. 04 Jun, 2012 1 commit
    • Ian Barber's avatar
      On the advice of Martin Hurton, removed the new command type and just terminated… · c13f1d52
      Ian Barber authored
      On the advice of Martin Hurton, removed the new command type and just terminated the pipe in a reconnect situation, and notified the socket of the same. This handles the blocking properly, but at the cost of potentially losing in flight messages. However, this is a reasonable trade off given how much simpler it makes the patch.
      c13f1d52
  2. 03 Jun, 2012 3 commits
    • Ian Barber's avatar
      Fix condition so that PGM and EPGM sockets always create pipes immediately, even… · b5ace39e
      Ian Barber authored
      Fix condition so that PGM and EPGM sockets always create pipes immediately, even if delay_attach_on_connect is set. This allows passing through the icanhasall flag, and is realistic given the fact those protocols should be able to connect immediately
      b5ace39e
    • Ian Barber's avatar
      Fix a number of whitespace issues in various parts of the code, add validation… · 6f6466f0
      Ian Barber authored
      Fix a number of whitespace issues in various parts of the code, add validation to most calls on the test and take a first stab at implementing the reconnection pipe blocking.
      
      It didn't seem straightforward to use any of the existing process calls, so I have added a new command to command_t and friends called detach. This instructs the socket_base to remove the pipe from it's pipe list. The session base stores a copy of the outpipe, and will resend the bind command on reconnection. This should allow balancing again.
      6f6466f0
    • Ian Barber's avatar
      Remove the extra outpipe handling as the session is quite capable of delaying… · 06485d92
      Ian Barber authored
      Remove the extra outpipe handling as the session is quite capable of delaying the creation of the pipe until the connection has happened. Simply don't build the pipe, and let it do that automatically.
      06485d92
  3. 01 Jun, 2012 2 commits
    • Douglas Young's avatar
      320684ef
    • Ian Barber's avatar
      After speaking with Ben Gray and the discussion on the mailing list, this is an… · fe3fb419
      Ian Barber authored
      After speaking with Ben Gray and the discussion on the mailing list, this is an attempt to create a sockopt to allow connecting pipes to not immediately be available for traffic. The problem is in a PUSH to many PULL situation, where there is a connect to a PULL which is not there. This connect will immediately create a pipe (unlike bind), and traffic will be load balanced to that pipe. This means if there is a persistently unavailable end point then the traffic will queue until HWM is hit, and older messages will be lost.
      
      This patch adds a sockopt ZMQ_DELAY_ATTACH_ON_CONNECT, which if set to 1 will attempt to preempt this behavior. It does this by extending the use of the session_base to include in the outbound as well as the inbound pipe, and only associates the pipe with the socket once it receives the connected callback via a process_attach message. This works, and a test has been added to show so, but may introduce unexpected complications. The shutdown logic in this class has become marginally more awkward because of this, requiring the session to serve as the sink for both pipes if shutdown occurs with a still-connecting pipe in place. It is also possible there could be issues around flushing the messages, but as I could not directly think how to create such an issue I have not written any code with regards to that.
      
      The documentation has been updated to reflect the change, but please do check over the code and test and review.
      fe3fb419
  4. 31 May, 2012 1 commit
  5. 28 May, 2012 1 commit
  6. 21 May, 2012 1 commit
  7. 20 May, 2012 2 commits
  8. 04 May, 2012 1 commit
  9. 28 Apr, 2012 1 commit
  10. 21 Apr, 2012 3 commits
    • Sergey KHripchenko's avatar
      add process_commands() to the beginning of zmq_connect() and zmq_bind() · f858321c
      Sergey KHripchenko authored
      I believe there was a conception that zmq_connect() and zmq_bind() will be called
      only at the socket creation time and therefore don't need it.
      Now it is not true anymore.
      f858321c
    • Sergey KHripchenko's avatar
      fixes for zmq_unbind() / zmq_disconnect() usage corner cases · 057fab09
      Sergey KHripchenko authored
      1. when we call zmq_bind()/zmq_connect() to create endpoint
      we send ourselfs(through launch_child()) command to process_own(endpoint)
      (and add it to own_t::owned)
      in the application thread we could call zmq_unbind() / zmq_disconnect() _BEFORE_
      we run process_own() in ZMQ thread and in this situation we will be unable to find it in
      own_t::owned. in other words own_t::owned.find(endpoint) will not be deleted but it will be deleted from
      socket_base_t::endpoints.
      
      2. when you zmq_unbind() the lisnening TCP/IPC socket was terminated only in destructor...
      so the whole ZMQ_LINGER time listening TCP/IPC socket was able to accept() new connections
      but unable to handle them.
      
      this all geting even worse since unfortunately zmq has a bug and '*_listener_t' object not terminated
      untill the socket's zmq_close().
      AT LEAST FOR PUSH SOCKETS.
      Everything is ok for SUB sockets.
      
      Easy to reproduce without my fix:
      
      zmq_socket(PUSH)
      zmq_bind(tcp);
      // connect to  it from PULL socket
      zmq_unbind(tcp);
      
      sleep(forever)
      
      // netstat -anp | grep 'tcp listening socket'
      
      With my fix you could see that after zmq_unbind(tcp) all previously connected tcp sessions
      will not be finished untill the zmq_close(socket) regardless of ZMQ_LINGER value.
      
      (*_listener_t terminates all owned session_base_t(connect=false) and they call pipe_t::terminate()
      which in turn should call session_base_t::terminated() but this never happens)
      057fab09
    • Sergey KHripchenko's avatar
      small wording change · 06b2eae8
      Sergey KHripchenko authored
      06b2eae8
  11. 20 Apr, 2012 1 commit
  12. 18 Apr, 2012 1 commit
  13. 17 Apr, 2012 1 commit
  14. 05 Apr, 2012 1 commit
  15. 04 Apr, 2012 1 commit
    • Martin Hurton's avatar
      Flush identity message for inproc transport · b41036aa
      Martin Hurton authored
      The scoket implementation for inproc transfer failed to flush
      identity message. The result was that the identity message
      was not delivered until after the user sent the first message.
      
      The identity message was never delivered if the user
      used the socket only to receive messages.
      b41036aa
  16. 22 Mar, 2012 2 commits
  17. 20 Mar, 2012 1 commit
    • Pieter Hintjens's avatar
      Fixed issues #337, #341, and #340 · 6e71a54b
      Pieter Hintjens authored
      * Implemented new ctx API (_new, _destroy, _get, _set)
      * Removed 'typesafe' macros from zmq.h
      * Added support for MAX_SOCKETS (was tied into change for #337)
      * Created new man pages
      6e71a54b
  18. 19 Mar, 2012 2 commits
  19. 14 Mar, 2012 1 commit
    • boris@boressoft.ru's avatar
      Add WinCE support. · 318ba883
      boris@boressoft.ru authored
      * Added two new files: errno.hpp and errno.cpp. They are required to use errno functionality on WM.
      * zmq.cpp, msg.h: removed inclusion of errno.h because it is included in zmq.h that is also included by .cpp.
      * windows.hpp: process.h is included only for desktop builds.
      * thread.cpp: on CE CreateThread is used instead of __beginthreadex
      * socket_base.cpp, clock.cpp: on CE include cmnintrin.h instead on intrin.h
      * signaler.cpp: on Windows should use special macro around event name (for unicode builds)
      * err.hpp: make it include errno.hpp (my file) instead on errno.h when building for CE
      * err.cpp: use FormatMessage when building for CE (because CE does not have ANSI API functions)
      * zmq.h: do not include errno.h whe building for CE
      * libzmq.vcproj: add tro new files
      318ba883
  20. 18 Feb, 2012 1 commit
  21. 17 Feb, 2012 1 commit
  22. 16 Feb, 2012 1 commit
  23. 15 Feb, 2012 1 commit
  24. 14 Feb, 2012 1 commit
  25. 10 Feb, 2012 1 commit
  26. 08 Feb, 2012 1 commit
  27. 03 Feb, 2012 2 commits
    • skaller's avatar
      Set and arrange propagation of thread safe sockets flag. · 520ad3c2
      skaller authored
      We use a distinct context initialisation function to specify
      all sockets derived therefrom will be thread safe.
      
      However the inheritance is done exclusively in the C interface.
      This is not really correct, but it is chosen to minimise
      interference with the existing C++ code, including any
      construct or other calls within the C++ code base.
      Semantically the C++ code should be unchanged,
      physically some data structures and extra methods are
      provided by they're only used from the C binding.
      520ad3c2
    • skaller's avatar
      Thread Safe Sockets. · 988efbc7
      skaller authored
      1. Reorganise C API socket functions to eliminate bad practice
      of public functions calling other public functions. This should
      be done for msg's too but hasn't been in this patch.
      
      2. Reorganise code in C API socket functions so that the
      socket is cast on one line, the C++ function called on
      the next with the result retained, then the result is returned.
      
      This makes the code much simpler to read and also allows
      pre- and post- call hooks to be inserted easily.
      
      3. Insert pre- and post- call hooks which set and release
      a mutex iff the thread_safe flag is on.
      
      4. Add the thread_safe_flag to base_socket_t initialised to
      false to preserve existing semantics. Add an accessor for
      the flag, add a mutex, and add lock and unlock functions.
      
      Note: as yet no code to actually set the flag.
      988efbc7
  28. 02 Feb, 2012 1 commit
  29. 16 Dec, 2011 1 commit
  30. 06 Nov, 2011 1 commit
  31. 05 Nov, 2011 1 commit