text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>dpointSep = fmt.Sprintf("%c", EndpointSepChar)
directResolverBuilder directBuilder
discovResolverBuilder discovBuilder
etcdResolverBuilder etcdBuilder
)
func register() {
resolver.Register(&directResolverBuilder)
resolver.Register(&discovResolverBuilder)
resolver.Register(&etcdResolverBuilder)
}... | fim | zeromicro/go-zero | go |
<|fim_suffix|>nc (m *mockedClientConn) NewAddress(_ []resolver.Address) {
}
func (m *mockedClientConn) NewServiceConfig(_ string) {
}
func (m *mockedClientConn) ParseServiceConfig(_ string) *serviceconfig.ParseResult {
return nil
}
<|fim_prefix|>package internal
import (
"testing"
"github.com/stretchr/testify/as... | fim | zeromicro/go-zero | go |
<|fim_prefix|>package internal
import "math/rand"
fun<|fim_suffix|> rand.Shuffle(len(set), func(i, j int) {
set[i], set[j] = set[j], set[i]
})
if len(set) <= sub {
return set
}
return set[:sub]
}
<|fim_middle|>c subset(set []string, sub int) []string {
<|endoftext|> | fim | zeromicro/go-zero | go |
<|fim_suffix|>ge tests {
test := test
t.Run(test.name, func(t *testing.T) {
var vals []string
for i := 0; i < test.set; i++ {
vals = append(vals, strconv.Itoa(i))
}
m := make(map[any]int)
for i := 0; i < 1000; i++ {
set := subset(append([]string(nil), vals...), test.sub)
if test.sub < te... | fim | zeromicro/go-zero | go |
<|fim_prefix|>package targets
import (
"strings"
"google.golang.org/grpc/resolver"
)
const slashSeparator = "/"
// GetAuthority returns the authority of the target.
func GetAuthority(target resolver.Target) string {
return target.URL.Host
}
// GetEndpoints returns the endpoi<|fim_suffix|>ts encoded in URL path ... | fim | zeromicro/go-zero | go |
<|fim_suffix|>ority1,my_authority2/localhost,localhost",
want: "my_authority1,my_authority2",
},
{
name: "test with multiple hosts with port",
url: "direct://my_authority1:3000,my_authority2:3001/localhost:8080,localhost:8081",
want: "my_authority1:3000,my_authority2:3001",
},
}
for _, test := ran... | fim | zeromicro/go-zero | go |
<|fim_suffix|>ally.
func Register() {
internal.RegisterResolver()
}
<|fim_prefix|>package resolver
import "github.com/zeromicro/go-zero/zrpc/resolver/inte<|fim_middle|>rnal"
// Register registers schemes defined zrpc.
// Keep it in a separated package to let third party register manu<|endoftext|> | fim | zeromicro/go-zero | go |
<|fim_suffix|> {
assert.NotPanics(t, func() {
Register()
})
}
<|fim_prefix|>package resolver
import (
"testing"
"github.com/stretchr/t<|fim_middle|>estify/assert"
)
func TestRegister(t *testing.T)<|endoftext|> | fim | zeromicro/go-zero | go |
<|fim_suffix|>d
// hosts in the URI authority, which Go 1.26+ rejects per RFC 3986.
func BuildDiscovTarget(endpoints []string, key string) string {
return fmt.Sprintf("%s:///%s?key=%s", internal.EtcdScheme,
strings.Join(endpoints, internal.EndpointSep), url.QueryEscape(key))
}
<|fim_prefix|>package resolver
import ... | fim | zeromicro/go-zero | go |
<|fim_prefix|>package resolver
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBuildDirectTarget(t *testing.T) {
target := BuildDirectTarget([]string{"localhost:123", "localhost:456"})
assert.Equal(t, "direct:///localhost:1<|fim_suffix|>
target := BuildDiscovTarget([]string{"localhost:2379"},... | fim | zeromicro/go-zero | go |
<|fim_prefix|>package zrpc
import (
"time"
"github.com/zeromicro/go-zero/core/load"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/core/stat"
"github.com/zeromicro/go-zero/core/stores/redis"
"github.com/zeromicro/go-zero/zrpc/internal"
"github.com/zeromicro/go-zero/zrpc/internal/auth"
... | fim | zeromicro/go-zero | go |
<|fim_prefix|>package zrpc
import (
"context"
"testing"
"time"
"github.com/alicebob/miniredis/v2"
"github.com/stretchr/testify/assert"
"github.com/zeromicro/go-zero/core/discov"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/core/service"
"github.com/zeromicro/go-zero/core/stat"
"git... | fim | zeromicro/go-zero | go |
<|fim_suffix|>,
NULL,
errno,
0,
(LPTSTR)&error_desc_buff,
1024,
NULL
);
return error_desc_buff;
}
#endif<|fim_prefix|>#if defined _WIN32_WCE
//#include "..\..\include\zmq.h"
#include "..\..\src\err.hpp"
int errno;
int _doserrno;
int _sys_nerr;
char* error_... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>plusplus
};
#endif
#endif<|fim_prefix|>#ifndef ERRNO_H
#define ERRNO_H 1
//#define EPERM 1
//#define ENOENT 2
//#define ESRCH 3
#define EINTR 4
//#define EIO 5
//#define ENXIO 6
//#define E2BIG 7
//#define ENOEXEC 8
#define E... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>terface unless a sibling `libsodium` directory to that of this
// repository exists and contains the following files:
//
// \builds\msvc\vs2015\libsodium.import.props
// \builds\msvc\vs2015\libsodium.import.xml
#endif
<|fim_prefix|>#ifndef __PL<|fim_middle|>ATFORM_HPP_INCLUDED__
#define __PLATFORM_HPP_IN... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by resource.rc
// Next default val<|fim_suffix|>SOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
<|fim_... | fim | zeromq/libzmq | c |
<|fim_suffix|>.lib")
#pragma comment(lib,"Iphlpapi.lib")
#endif
<|fim_prefix|>#ifndef __<|fim_middle|>PLATFORM_HPP_INCLUDED__
#define __PLATFORM_HPP_INCLUDED__
#define ZMQ_HAVE_WINDOWS
#define ZMQ_HAVE_WINDOWS_TARGET_XP
#define ZMQ_BUILD_DRAFT_API
#define ZMQ_USE_SELECT
#define FD_SETSIZE 1024
#pragma comment(lib,... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>kers
std::thread w[SERVER_WORKER_COUNT];
for (int i = 0; i < SERVER_WORKER_COUNT; i++) w[i] = std::thread(worker, i);
// ZMQ_SERVER for client messages
server_sock = zmq_socket(server_ctx, ZMQ_SERVER); assert(server_sock);
rc = zmq_bind(server_sock, SERVER_ADDR); assert(rc == 0);
while (1) {
// w... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PLATFORM_HPP_INCLUDED__
#define __ZMQ_PLATFORM_HPP_INCLUDED__
// This file provides the configuration for Linux, Windows, and OS/X
// as determined by ZMQ_HAVE_XXX macros passed from project.gyp
// Check that we're being called from our gyp makefi... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_PLATFORM_HPP_INCLUDED__
#define __ZMQ_PLATFORM_HPP_INCLUDED__
// This is the platform <|fim_suffix|>t step of the build process it is copied to
// zmq directory to take place of platform.hpp generated from
// platform.hpp.in on platforms supported ... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>ether SO_KEEPALIVE is supported. */
#define ZMQ_HAVE_SO_KEEPALIVE 1
/* Have SO_PEERCRED socket option */
/* #undef ZMQ_HAVE_SO_PEERCRED */
/* Whether TCP_KEEPALIVE is supported. */
/* #undef ZMQ_HAVE_TCP_KEEPALIVE */
/* Whether TCP_KEEPCNT is supported. */
/* #undef ZMQ_HAVE_TCP_KEEPCNT */
/* Whether ... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* src/platform.hpp. Generated from platform.hpp.in by configure. */
/* src/platform.hpp.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <alloca.h> header file. */
/* #undef HAVE_ALLOCA_H */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_AR... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "testutil.hpp"
#include <unistd.h> // For alarm()
const char *address = "tcp://127.0.0.1:6571";
#define NUM_MESSAGES 5
#define TIMEOUT_SECS 5 // Global timeout
int main (void)
{
setup_test_environment ();
void *ctx = zmq_ctx_new ... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> c = S(30, b);
b = a;
a = tmp;
}
H(0) = H(0) + a;
H(1) = H(1) + b;
H(2) = H(2) + c;
H(3) = H(3) + d;
H(4) = H(4) + e;
memset(&ctxt->m.b8[0], 0, 64);
}
/*------------------------------------------------------------*/
void
sha1_init(struct sha1_ctxt * ctxt)
{
memset(ctxt, 0, sizeof(struct s... | fim | zeromq/libzmq | c |
<|fim_suffix|>TINET6_SHA1_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include "../../src/stdint.hpp"
struct sha1_ctxt
{
union
{
uint8_t b8[20];
uint32_t b32[5];
} h;
union
{
uint8_t b8[8];
uint64_t b64[1];
} c;
union
{
uint8_t b8[64];
uint32_t b32[16];
} m;
uint8_t count;
};
... | fim | zeromq/libzmq | c |
<|fim_prefix|>/* =========================================================================
Unity Project - A Test Framework for C
Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
[Released under MIT License. Please refer to license.txt for details]
=======================================... | fim | zeromq/libzmq | c |
<|fim_prefix|>/* ==========================================
Unity Project - A Test Framework for C
Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
[Released under MIT License. Please refer to license.txt for details]
========================================== */
#ifndef UNITY_FRAMEWORK... | fim | zeromq/libzmq | c |
/* ==========================================
Unity Project - A Test Framework for C
Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
[Released under MIT License. Please refer to license.txt for details]
========================================== */
#ifndef UNITY_INTERNALS_H
#define UNI... | fim | zeromq/libzmq | c |
<|fim_suffix|>or (;;) {
base_socket = ws__ioctl_get_bsp_socket(socket, SIO_BASE_HANDLE);
if (base_socket != INVALID_SOCKET)
return base_socket;
error = GetLastError();
if (error == WSAENOTSOCK)
return_set_error(INVALID_SOCKET, error);
/* Even though Microsoft documentation clearly stat... | fim | zeromq/libzmq | c |
<|fim_prefix|>/*
* wepoll - epoll for Windows
* https://github.com/piscisaureus/wepoll
*
* Copyright 2012-2020, Bert Belder <bertbelder@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary<|fim_suffix|>mer.
*
* * Redistributions in binary form must reproduce the above copyright
... | fim | zeromq/libzmq | c |
<|fim_suffix|> *s_, const char *addr_);
ZMQ_EXPORT int zmq_connect (void *s_, const char *addr_);
ZMQ_EXPORT int zmq_unbind (void *s_, const char *addr_);
ZMQ_EXPORT int zmq_disconnect (void *s_, const char *addr_);
ZMQ_EXPORT int zmq_send (void *s_, const void *buf_, size_t len_, int flags_);
ZMQ_EXPORT int
zmq_send_c... | fim | zeromq/libzmq | c |
<|fim_suffix|>iagnostic pop
#endif
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
/* This file is deprecated, and all its functionality provided by zmq.h */
/* Note that -Wpedantic compilation requires GCC to avoid using its custom
extensions such as #warning, hence the trick below. Also, pragma... | fim | zeromq/libzmq | c |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#if __cplusplus >= 201103L
#include "radix_tree.hpp"
#include "trie.hpp"
#include <chrono>
#include <cstddef>
#include <cstdio>
#include <random>
#include <ratio>
#include <vector>
const std::size_t nkeys = 10000;
const std::size_t nqueries = 1000000;
const std::... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>#!/usr/bin/python3
#
# This script assumes that the set of CSV files produced by "generate_csv.sh" is provided as input
# and that locally there is the "results" folder.
#
# results for TCP:
INPUT_FILE_PUSHPULL_TCP_THROUGHPUT="results/pushpull_tcp_thr_results.csv"
INPUT_FILE_REQREP_TCP_LATENCY="results/... | fim | zeromq/libzmq | python |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "../include/zmq.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS
#include <windows.h>
#include <process.h>
#else
#include <pthread.h>
#endif
static size_t message_size;
static int roundtr... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>", zmq_strerror (errno));
return -1;
}
rc = zmq_ctx_term (ctx);
if (rc != 0) {
printf ("error in zmq_ctx_term: %s\n", zmq_strerror (errno));
return -1;
}
throughput =
(unsigned long) ((double) message_count / (double) elapsed * 1000000);
megabits = (... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> if (rc < 0) {
printf ("error in zmq_sendmsg: %s\n", zmq_strerror (errno));
return -1;
}
}
rc = zmq_msg_close (&msg);
if (rc != 0) {
printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
return -1;
}
zmq_sleep (1);
rc ... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>ockoopt: %s\n", zmq_strerror (errno));
return -1;
}
}
rc = zmq_bind (s, bind_to);
if (rc != 0) {
printf ("error in zmq_bind: %s\n", zmq_strerror (errno));
return -1;
}
rc = zmq_msg_init (&msg);
if (rc != 0) {
printf ("error in zmq_msg_i... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>mq_close (frontend_xsub);
zmq_close (backend_xpub);
zmq_close (control_rep);
//printf ("proxy thread ended\n");
}
void terminate_proxy (const proxy_hwm_cfg_t *cfg)
{
// CONTROL REQ
void *control_req = zmq_socket (
cfg->context,
ZMQ_REQ); // This one can be used to send ... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "../include/zmq.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (int argc, char *argv[])
{
const char *connect_to;
int roundtrip_count;
size_t message_size;
void *ctx;
void *s;
int rc;
int i;
zmq_msg_t... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> return -1;
}
}
rc = zmq_close (s);
if (rc != 0) {
printf ("error in zmq_close: %s\n", zmq_strerror (errno));
return -1;
}
rc = zmq_ctx_term (ctx);
if (rc != 0) {
printf ("error in zmq_ctx_term: %s\n", zmq_strerror (errno));
return ... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "macros.hpp"
#include "address.hpp"
#include "ctx.hpp"
#include "err.hpp"
#include "tcp_address.hpp"
#include "udp_address.hpp"
#include "ipc_address.hpp"
#include "tipc_address.hpp"
#include "ws_address.hpp"
#if defined ZMQ_HAVE... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>en_t;
#else
typedef socklen_t zmq_socklen_t;
#endif
enum socket_end_t
{
socket_end_local,
socket_end_remote
};
zmq_socklen_t
get_socket_address (fd_t fd_, socket_end_t socket_end_, sockaddr_storage *ss_);
template <typename T>
std::string get_socket_name (fd_t fd_, socket_end_t socket_end_)
{
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_ARRAY_INCLUDED__
#define __ZMQ_ARRAY_INCLUDED__
#include <vector>
#include <algorithm>
#include "macros.hpp"
namespace zmq
{
// Implementation of fast arrays with O(1) access, insertion and
// removal. The array stores pointers rather than objects... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_ATOMIC_COUNTER_HPP_INCLUDED__
#define __ZMQ_ATOMIC_COUNTER_HPP_INCLUDED__
#include "stdint.hpp"
#include "macros.hpp"
#if defined ZMQ_FORCE_MUTEXES
#define ZMQ_ATOMIC_COUNTER_MUTEX
#elif (defined __cplusplus && __cplusplus >= 201103L) ... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_ATOMIC_PTR_HPP_INCLUDED__
#define __ZMQ_ATOMIC_PTR_HPP_INCLUDED__
#include "macros.hpp"
#if defined ZMQ_FORCE_MUTEXES
#define ZMQ_ATOMIC_PTR_MUTEX
#elif (defined __cplusplus && __cplusplus >= 201103L) \
|| (defined _MSC_VER... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> _size = size_;
_owned = true;
if (size_ && _data) {
memcpy (_data, data_, size_);
}
}
// Empties a blob_t.
void clear ()
{
if (_owned) {
free (_data);
}
_data = 0;
_size = 0;
}
~blob_t ()
{... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>the data buffer.
const int rc = msg_->init ();
errno_assert (rc == 0);
return 0;
}
int zmq::channel_t::xrecv (msg_t *msg_)
{
// Deallocate old content of the message.
int rc = msg_->close ();
errno_assert (rc == 0);
if (!_pipe) {
// Initialise the output parameter ... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_CHANNEL_HPP_INCLUDED__
#define __ZMQ_CHANNEL_HPP_INCLUDED__
#include "blob.hpp"
#include "socket_base.hpp"
#include "session_base.hpp"
namespace zmq
{
class ctx_t;
clas<|fim_suffix|>E_NOR_MOVABLE (channel_t)
};
}
#endif
<|fim_middle|>s msg_t;
class ... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>rminated (pipe_);
}
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "macros.hpp"
#include "client.hpp"
#include "err.hpp"
#include "msg.hpp"
zmq::client_t::client_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_, true)
{
... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>activated (zmq::pipe_t *pipe_);
void xpipe_terminated (zmq::pipe_t *pipe_);
private:
// Messages are fair-queued from inbound pipes. And load-balanced to
// the outbound pipes.
fq_t _fq;
lb_t _lb;
ZMQ_NON_COPYABLE_NOR_MOVABLE (client_t)
};
}
#endif
<|fim_prefix|>/* SPDX-Lice... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "clock.hpp"
#include "likely.hpp"
#include "config.hpp"
#include "err.hpp"
#include "mutex.hpp"
#include <stddef.h>
#if defined _MSC_VER
#if defined _WIN32_WCE
#include <cmnintrin.h>
#else
#include <intrin.h>
#if defined(_M_ARM)... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_CLOCK_HPP_INCLUDED__
#define __ZMQ_CLOCK_HPP_INCLUDED__
#include "macros.hpp"
#include "stdint.hpp"
#if defined ZMQ_HAVE_OSX
// TO<|fim_suffix|>l time corresponding to the TSC above (in milliseconds).
uint64_t _last_time;
ZMQ_NON_COPYABLE_NO... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_COMMAND_HPP_INCLUDED__
#define __ZMQ_COMMAND_HPP_INCLUDED__
#include <string>
#include "stdint.hpp"
#include "endpoint.hpp"
#include "platform.hpp"
namespace zmq
{
class object_t;
class own_t;
struct i_engine;
class pipe_t;
class socket_base_t;
// ... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>{
for (size_t i = 0; i < len; i++) {
if (s[i] == '\0')
return i + 1;
}
return len;
}
#endif
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_COMPAT_HPP_INCLUDED__
#define __ZMQ_COMPAT_HPP_INCLUDED__
#include "precompiled.hpp"
#include <string.h>... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_CONDITON_VARIABLE_HPP_INCLUDED__
#define __ZMQ_CONDITON_VARIABLE_HPP_INCLUDED__
#include "err.hpp"
#include "mutex.hpp"
// Condition variable class encapsulates OS mutex in a platform-independent way.
#if defined(ZMQ_USE_CV_IMPL_NONE)
namespace zm... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_CONFIG_HPP_INCLUDED__
#define __ZMQ_CONFIG_HPP_INCLUDED__
namespace zmq
{
// Compile-time settings.
enum
{
// Number of new messages in message pipe needed to trigger new memory
// allocation. Setting this parameter to 256 decreases the impact of
//... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> bind_socket_->inc_seqnum ();
pending_connection_.bind_pipe->set_tid (bind_socket_->get_tid ());
if (!bind_options_.recv_routing_id) {
msg_t msg;
const bool ok = pending_connection_.bind_pipe->read (&msg);
zmq_assert (ok);
const int rc = msg.close ();
err... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>rns NULL if no I/O thread is available.
zmq::io_thread_t *choose_io_thread (uint64_t affinity_);
// Returns reaper thread object.
zmq::object_t *get_reaper () const;
// Management of inproc endpoints.
int register_endpoint (const char *addr_, const endpoint_t &endpoint_);
int u... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>NEXPECTED_COMMAND);
errno = EPROTO;
rc = -1;
}
if (rc == 0) {
rc = msg_->close ();
errno_assert (rc == 0);
rc = msg_->init ();
errno_assert (rc == 0);
}
return rc;
}
int zmq::curve_client_t::encode (msg_t *msg_)
{
zmq_assert (_state ==... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_CURVE_CLIENT_HPP_INCLUDED__
#define __ZMQ_CURVE_CLIENT_HPP_INCLUDED__
#ifdef ZMQ_HAVE_CURVE
#include "curve_mechanism_base.hpp"
#include "options.hpp"
#include "curve_client_tools.hpp"
namespace zmq
{
cl<|fim_suffix|>n_base_t *session_,
... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> *data_, const uint64_t cn_nonce_) const
{
return produce_hello (data_, server_key, cn_nonce_, cn_public,
cn_secret);
}
int process_welcome (const uint8_t *msg_data_,
size_t msg_size_,
uint8_t *cn_precom_)... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>(rc == 0);
uint8_t *const message = static_cast<uint8_t *> (msg_->data ());
memcpy (message + message_header_len, &message_box[crypto_box_BOXZEROBYTES],
mlen - crypto_box_BOXZEROBYTES);
#endif
memcpy (message, message_command, message_command_len);
memcpy (message + message_... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_CURVE_MECHANISM_BASE_HPP_INCLUDED__
#define __ZMQ_CURVE_MECHANISM_BASE_HPP_INCLUDE<|fim_suffix|>ry buffer used to speed up boxing and unboxing.
uint8_t _cn_precom[crypto_box_BEFORENMBYTES];
const bool _downgrade_sub;
ZMQ_NON_COPYABLE_NOR_... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "macros.hpp"
#ifdef ZMQ_HAVE_CURVE
#include "msg.hpp"
#include "session_base.hpp"
#include "err.hpp"
#include "curve_server.hpp"
#include "wire.hpp"
#include "secure_allocator.hpp"
zmq::curve_server_t::curve_server_t (session_b... | fim | zeromq/libzmq | cpp |
<|fim_suffix|><|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_CURVE_SERVER_HPP_INCLUDED__
#define __ZMQ_CURVE_SERVER_HPP_INCLUDED__
#ifdef ZMQ_HAVE_CURVE
#include "curve_mechanism_base.hpp"
#include "options.hpp"
#include "zap_client.hpp"
namespace zmq
{
#ifdef _MSC_VER
#pragma warning(push)
#pra... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_DBUFFER_HPP_INCLUDED__
#define __ZMQ_DBUFFER_HPP_INCLUDED__
#include <stdlib.h>
#include <stddef.h>
#include <algorithm>
#include "mutex.hpp"
#include "msg.hpp"
namespace zmq
{
// dbuffer is a single-producer single-consumer double-buffer
// imple... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "macros.hpp"
#include "dealer.hpp"
#include "err.hpp"
#include "msg.hpp"
zmq::dealer_t::dealer_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_), _probe_router (false)
{
options.type ... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>er
bool _probe_router;
ZMQ_NON_COPYABLE_NOR_MOVABLE (dealer_t)
};
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_DEALER_HPP_INCLUDED__
#define __ZMQ_DEALER_HPP_INCLUDED__
#include "socket_base.hpp"
#include "session_base.hpp"
#include "fq.hpp"
#include "lb.hpp"
na... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_DECODER_HPP_I<|fim_suffix|> }
A &get_allocator () { return _allocator; }
private:
// Next step. If set to NULL, it means that associated data stream
// is dead. Note that there can be still data in the process in such
// case.
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "decoder_allocators.hpp"
#include "msg.hpp"
zmq::shared_message_memory_allocator::shared_message_memory_allocator (
std::size_t bufsize_) :
_buf (NULL),
_buf_size (0),
_max_size (bufsize_),
_msg_content (NULL),... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_DECODER_ALLOCATORS_HPP_INCLUDED__
#define __ZMQ_DECODER_ALLOCATORS_HPP_INCLUDED__
#include <cstddef>
#include <cstdlib>
#include "atomic_counter.hpp"
#include "msg.hpp"
#include "err.hpp"
namespace zmq
{
// Static buffer policy.
class c_single_alloc... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>++)
fd_table[pending_list[i]].accepted = true;
pending_list.clear ();
// Execute any due timers.
int timeout = (int) execute_timers ();
if (get_load () == 0) {
if (timeout == 0)
break;
// TODO sleep for timeout
... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> "/dev/poll" pseudo-device.
fd_t devpoll_fd;
struct fd_entry_t
{
short events;
zmq::i_poll_events *reactor;
bool valid;
bool accepted;
};
typedef std::vector<fd_entry_t> fd_table_t;
fd_table_t fd_table;
typedef std::vector<fd_t> pending_list_t... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "macros.hpp"
#include "dgram.hpp"
#include "pipe.hpp"
#include "wire.hpp"
#include "random.hpp"
#include "likely.hpp"
#include "err.hpp"
zmq::dgram_t::dgram_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, ... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>ut;
ZMQ_NON_COPYABLE_NOR_MOVABLE (dgram_t)
};
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_DGRAM_HPP_I<|fim_middle|>NCLUDED__
#define __ZMQ_DGRAM_HPP_INCLUDED__
#include "blob.hpp"
#include "socket_base.hpp"
#include "session_base.hpp"
namespace zmq
{
class ctx_t;
c... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>ally_initiated_);
zmq_assert (pipe_);
_fq.attach (pipe_);
_dist.attach (pipe_);
// Send all the cached subscriptions to the new upstream peer.
send_subscriptions (pipe_);
}
void zmq::dish_t::xread_activated (pipe_t *pipe_)
{
_fq.activated (pipe_);
}
void zmq::dish_t::xwrite_ac... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>functions from session_base_t.
int push_msg (msg_t *msg_);
int pull_msg (msg_t *msg_);
void reset ();
private:
enum
{
group,
body
} _state;
msg_t _group_msg;
ZMQ_NON_COPYABLE_NOR_MOVABLE (dish_session_t)
};
}
#endif
<|fim_prefix|>/* SPDX-License-Identi... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> // Mark the pipe as matching.
_pipes.swap (_pipes.index (pipe_), _matching);
_matching++;
}
void zmq::dist_t::reverse_match ()
{
const pipes_t::size_type prev_matching = _matching;
// Reset matching to 0
unmatch ();
// Mark all matching pipes as not matching and vice-versa.
... | fim | zeromq/libzmq | cpp |
/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_DIST_HPP_INCLUDED__
#define __ZMQ_DIST_HPP_INCLUDED__
#include <vector>
#include "array.hpp"
#include "macros.hpp"
namespace zmq
{
class pipe_t;
class msg_t;
// Class manages a set of outbound pipes. It sends each messages to
// each of them.
class dist_t
{
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_ENCODER_HPP_INCLUDED__
#define __ZMQ_ENCODER_HPP_INCLUDED__
#if defined(_MSC_VER)
#ifndef NOMINMAX
#define NOMINMAX
#endif
#endif
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include "err.hpp"
#include "i_encoder... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "endpoint.hpp"
zmq::endpoint_uri_pair_t
zmq::make_unconnected_connect_endpoint_<|fim_suffix|>return endpoint_uri_pair_t (endpoint_, std::string (), endpoint_type_bind);
}
<|fim_middle|>pair (const std::string &endpoint_)
{
re... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>? local : remote;
}
bool clash () const { return local == remote; }
std::string local, remote;
endpoint_type_t local_type;
};
endpoint_uri_pair_t
make_unconnected_connect_endpoint_pair (const std::string &endpoint_);
endpoint_uri_pair_t
make_unconnected_bind_endpoint_pair (const std::s... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>d = _retired.end ();
it != end; ++it) {
LIBZMQ_DELETE (*it);
}
_retired.clear ();
}
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#if defined ZMQ_IOTHREAD_POLLER_USE_EPOLL
#include "epoll.hpp"
#if !defined ZMQ_HAVE_... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>VABLE (epoll_t)
};
typedef epoll_t poller_t;
}
#endif
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_EPOLL_HPP_INCLUDED__
#define __ZMQ_EPOLL_HPP_INCLUDED__
// poller.hpp decides which polling mechanism to use.
#include "poller.hpp"
#if defined ZMQ_IOTHREAD_POLLER_USE_EPOL... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "err.hpp"
#include "macros.hpp"
const char *zmq::errno_to_string (int errno_)
{
switch (errno_) {
#if defined ZMQ_HAVE_WINDOWS
case ENOTSUP:
return "Not supported";
case EPROTONOSUPPORT:
... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_ERR_HPP_INCLUDED__
#define __ZMQ_ERR_HPP_INCLUDED__
#include <assert.h>
#if defined _WIN32_WCE
#include "..\builds\msvc\errno.hpp"
#else
#include <errno.h>
#endif
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#ifndef ZMQ_HAVE_WINDOWS
#in... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>#if _MSC_VER >= 1800
: fd_t
#endif
{
retired_fd = INVALID_SOCKET
};
#endif
#else
enum
{
retired_fd = -1
};
#endif
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_FD_HPP_INCLUDED__
#define __ZMQ_FD_HPP_INCLUDED__
#if defined _WIN32
#include "windows.hpp"
#endif
name... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>
// If we've already received the first part of the message
// we should get the remaining parts without blocking.
zmq_assert (!_more);
_active--;
_pipes.swap (_current, _active);
if (_current == _active)
_current = 0;
}
// No messag... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_FQ_HPP_INCLUDED__
#define __ZMQ_FQ_HPP_INCLUDED<|fim_suffix|>ed at the
// beginning of the pipes array.
pipes_t::size_type _active;
// Index of the next bound pipe to read a message from.
pipes_t::size_type _current;
// If true... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#include "macros.hpp"
#include "gather.hpp"
#include "err.hpp"
#include "msg.hpp"
#include "pipe.hpp"
zmq::gather_t::gather_t (class ctx_t *parent_, uint32_t tid_<|fim_suffix|>t_, tid_, sid_, true)
{
options.type = ZMQ_GATHER;
}
zmq:... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> private:
// Fair queueing object for inbound pipes.
fq_t _fq;
ZMQ_NON_COPYABLE_NOR_MOVABLE (gather_t)
};
}
#endif
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_GATHER_HPP_INCLUDED__
#define __ZMQ_GATHER_HPP_INCLUDED__
#include "socket_base.hpp"
#include "fq.hpp"
nam... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>ue)
// or on every removal (false). The arg_ argument is passed
// through to the callback function.
template <typename Arg>
void rm (value_t *value_,
void (*func_) (const unsigned char *data_, size_t size_, Arg arg_),
Arg arg_,
bool call_on_uniq_);... | fim | zeromq/libzmq | cpp |
<|fim_suffix|> node, initialize the new_min/max parameters
// which will then be used after each child has been processed, on the
// post-children iterations.
if (it.current_child == 0) {
// New min non-null character in the node tab... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#ifdef HAVE_LIBGSSAPI_KRB5
#include <string.h>
#include <string>
#include "msg.hpp"
#include "session_base.hpp"
#include "err.hpp"
#include "gssapi_client.hpp"
#include "wire.hpp"
zmq::gssapi_client_t::gssapi_client_t (session_base_t *... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>uffer_desc *token_ptr;
// The desired underlying mechanism
gss_OID_set_desc mechs;
// True iff client considers the server authenticated
bool security_context_established;
int initialize_context ();
int produce_next_token (msg_t *msg_);
int process_next_token (msg_t *msg_)... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#ifdef HAVE_LIBGSSAPI_KRB5
#include <string.h>
#include <string>
#include "msg.hpp"
#include "session_base.hpp"
#include "err.hpp"
#include "gssapi_mechanism_base.hpp"
#include "wire.hpp"
zmq::gssapi_mechanism_base_t::gssapi_mechanism_... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#ifndef __ZMQ_GSSAPI_MECHANISM_BASE_HPP_INCLUDED__
#define __ZMQ_GSSAPI_MECHANISM_BASE_HPP_INCLUDED__
#ifdef HAVE_LIBGSSAPI_KRB5
#if HAVE_GSSAPI_GSSAPI_GENERIC_H
#include <gssapi/gssapi_generic.h>
#endif
#include <gssapi/gssapi_krb5.h>
#include "mechanism_base.hp... | fim | zeromq/libzmq | cpp |
<|fim_prefix|>/* SPDX-License-Identifier: MPL-2.0 */
#include "precompiled.hpp"
#ifdef HAVE_LIBGSSAPI_KRB5
#include <string.h>
#include <string>
#include "msg.hpp"
#include "session_base.hpp"
#include "err.hpp"
#include "gssapi_server.hpp"
#include "wire.hpp"
#include <gssapi/gssapi.h>
zmq::gssapi_server_t::gssap... | fim | zeromq/libzmq | cpp |
<|fim_suffix|>e_command (msg_t *msg_) ZMQ_FINAL;
int process_handshake_command (msg_t *msg_) ZMQ_FINAL;
int encode (msg_t *msg_) ZMQ_FINAL;
int decode (msg_t *msg_) ZMQ_FINAL;
int zap_msg_available () ZMQ_FINAL;
status_t status () const ZMQ_FINAL;
private:
enum state_t
{
send_next... | fim | zeromq/libzmq | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.