1 /*
2     Copyright (c) 2007-2011 iMatix Corporation
3     Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
4 
5     This file is part of 0MQ.
6 
7     0MQ is free software; you can redistribute it and/or modify it under
8     the terms of the GNU Lesser General Public License as published by
9     the Free Software Foundation; either version 3 of the License, or
10     (at your option) any later version.
11 
12     0MQ is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU Lesser General Public License for more details.
16 
17     You should have received a copy of the GNU Lesser General Public License
18     along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #include "../include/zmq.h"
22 
23 #include "pull.hpp"
24 #include "err.hpp"
25 
pull_t(class ctx_t * parent_,uint32_t tid_)26 zmq::pull_t::pull_t (class ctx_t *parent_, uint32_t tid_) :
27     socket_base_t (parent_, tid_),
28     fq (this)
29 {
30     options.type = ZMQ_PULL;
31     options.requires_in = true;
32     options.requires_out = false;
33 }
34 
~pull_t()35 zmq::pull_t::~pull_t ()
36 {
37 }
38 
xattach_pipes(class reader_t * inpipe_,class writer_t * outpipe_,const blob_t & peer_identity_)39 void zmq::pull_t::xattach_pipes (class reader_t *inpipe_,
40     class writer_t *outpipe_, const blob_t &peer_identity_)
41 {
42     zmq_assert (inpipe_ && !outpipe_);
43     fq.attach (inpipe_);
44 }
45 
process_term(int linger_)46 void zmq::pull_t::process_term (int linger_)
47 {
48     fq.terminate ();
49     socket_base_t::process_term (linger_);
50 }
51 
xrecv(zmq_msg_t * msg_,int flags_)52 int zmq::pull_t::xrecv (zmq_msg_t *msg_, int flags_)
53 {
54     return fq.recv (msg_, flags_);
55 }
56 
xhas_in()57 bool zmq::pull_t::xhas_in ()
58 {
59     return fq.has_in ();
60 }
61 
62