コード例 #1
0
ファイル: mlm_server.c プロジェクト: malanka/malamute
static void
write_message_to_stream (client_t *self)
{
    if (self->writer) {
        mlm_msg_t *msg = mlm_msg_new (
            self->address,
            self->writer->name,
            mlm_proto_subject (self->message),
            NULL,
            mlm_proto_timeout (self->message),
            mlm_proto_get_content (self->message));
        zsock_bsend (self->writer->msgpipe, "pp", self, msg);
    }
    else {
        engine_set_exception (self, exception_event);
        zsys_warning ("client attempted to send without writer");
    }
}
コード例 #2
0
ファイル: mlm_server.c プロジェクト: zhangjinde/malamute
static void
write_message_to_stream (client_t *self)
{
    if (self->writer) {
        mlm_msg_t *msg = mlm_msg_new (
            self->address,
            self->writer->name,
            mlm_proto_subject (self->message),
            NULL,
            mlm_proto_timeout (self->message),
            mlm_proto_get_content (self->message));
        zsock_bsend (self->writer->msgpipe, "pp", self, msg);
    }
    else {
        //  TODO: we can't properly reply to a STREAM_SEND
        mlm_proto_set_status_code (self->message, MLM_PROTO_COMMAND_INVALID);
        engine_set_exception (self, exception_event);
        zsys_warning ("client attempted to send without writer");
    }
}
コード例 #3
0
ファイル: mlm_stream_simple.c プロジェクト: hurtonm/malamute
static int
s_stream_engine_handle_message (stream_engine_t *self)
{
    void *sender;
    mlm_msg_t *msg;
    zsock_brecv (self->msgpipe, "pp", &sender, &msg);

    selector_t *selector = (selector_t *) zlistx_first (self->selectors);
    while (selector) {
        if (zrex_matches (selector->rex, mlm_msg_subject (msg))) {
            void *client = zlistx_first (selector->clients);
            while (client) {
                if (client != sender)
                    zsock_bsend (self->msgpipe, "pp", client, mlm_msg_link (msg));
                client = zlistx_next (selector->clients);
            }
        }
        selector = (selector_t *) zlistx_next (self->selectors);
    }
    mlm_msg_unlink (&msg);
    return 0;
}
コード例 #4
0
ファイル: upstream.c プロジェクト: taotetek/pressure
void
upstream_set_variance (zactor_t *upstream, int64_t size) {
    zstr_sendm (upstream, "SET_VARIANCE");
    zsock_bsend (upstream, "8", size);
}
コード例 #5
0
ファイル: upstream.c プロジェクト: taotetek/pressure
void
upstream_set_size (zactor_t *upstream, int64_t size) {
    zstr_sendm (upstream, "SET_SIZE");
    zsock_bsend (upstream, "8", size);
}
コード例 #6
0
ファイル: qzmq.c プロジェクト: jaeheum/qzmq
Z K2(zsockbsend){PC(x); TC(y,-KS); R kj(zsock_bsend(VSK(x), ys));}
コード例 #7
0
ファイル: QmlZsock.cpp プロジェクト: awakecoding/czmq
///
//  Send a binary encoded 'picture' message to the socket (or actor). This 
//  method is similar to zsock_send, except the arguments are encoded in a 
//  binary format that is compatible with zproto, and is designed to reduce
//  memory allocations. The pattern argument is a string that defines the  
//  type of each argument. Supports these argument types:                  
//                                                                         
//   pattern    C type                  zproto type:                       
//      1       uint8_t                 type = "number" size = "1"         
//      2       uint16_t                type = "number" size = "2"         
//      4       uint32_t                type = "number" size = "3"         
//      8       uint64_t                type = "number" size = "4"         
//      s       char *, 0-255 chars     type = "string"                    
//      S       char *, 0-2^32-1 chars  type = "longstr"                   
//      c       zchunk_t *              type = "chunk"                     
//      f       zframe_t *              type = "frame"                     
//      u       zuuid_t *               type = "uuid"                      
//      m       zmsg_t *                type = "msg"                       
//      p       void *, sends pointer value, only over inproc              
//                                                                         
//  Does not change or take ownership of any arguments. Returns 0 if       
//  successful, -1 if sending failed for any reason.                       
int QmlZsock::bsend (const QString &picture) {
    return zsock_bsend (self, picture.toUtf8().data());
};