Permalink
Browse files

problem: zproject out of date

  • Loading branch information...
wesyoung committed Oct 12, 2017
1 parent 8fa2340 commit 1339cac9df66ca45a75dfd4e1d405bada90b31d0
View
@@ -0,0 +1,68 @@
/*
zyre - an open-source framework for proximity-based P2P apps
Copyright (c) the Contributors as noted in the AUTHORS file.
This file is part of Zyre, an open-source framework for proximity-based
peer-to-peer applications -- See http://zyre.org.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
pipeline {
agent any
triggers {
pollSCM 'H/5 * * * *'
}
stages {
stage ('compile') {
steps {
sh './autogen.sh'
sh './configure'
sh 'make'
}
}
stage ('check') {
steps {
timeout (time: 5, unit: MINUTES) {
sh 'make check'
}
}
}
stage ('memcheck') {
steps {
timeout (time: 5, unit: MINUTES) {
sh 'make memcheck'
}
}
}
stage ('distcheck') {
steps {
timeout (time: 10, unit: MINUTES) {
sh 'make distcheck'
}
}
}
}
post {
success {
script {
if (currentBuild.getPreviousBuild()?.result != 'SUCCESS') {
// Uncomment desired notification
//slackSend (color: "#008800", message: "Build ${env.JOB_NAME} is back to normal.")
//emailext (to: "qa@example.com", subject: "Build ${env.JOB_NAME} is back to normal.", body: "Build ${env.JOB_NAME} is back to normal.")
}
}
}
failure {
// Uncomment desired notification
// Section must not be empty, you can delete the sleep once you set notification
sleep 1
//slackSend (color: "#AA0000", message: "Build ${env.BUILD_NUMBER} of ${env.JOB_NAME} ${currentBuild.result} (<${env.BUILD_URL}|Open>)")
//emailext (to: "qa@example.com", subject: "Build ${env.JOB_NAME} failed!", body: "Build ${env.BUILD_NUMBER} of ${env.JOB_NAME} ${currentBuild.result}\nSee ${env.BUILD_URL}")
}
}
}
@@ -272,6 +272,19 @@ Java_org_zeromq_zyre_Zyre__1_1peerHeaderValue (JNIEnv *env, jclass c, jlong self
return return_string_;
}
JNIEXPORT jint JNICALL
Java_org_zeromq_zyre_Zyre__1_1requirePeer (JNIEnv *env, jclass c, jlong self, jstring uuid, jstring endpoint, jstring public_key)
{
char *uuid_ = (char *) (*env)->GetStringUTFChars (env, uuid, NULL);
char *endpoint_ = (char *) (*env)->GetStringUTFChars (env, endpoint, NULL);
char *public_key_ = (char *) (*env)->GetStringUTFChars (env, public_key, NULL);
jint require_peer_ = (jint) zyre_require_peer ((zyre_t *) (intptr_t) self, uuid_, endpoint_, public_key_);
(*env)->ReleaseStringUTFChars (env, uuid, uuid_);
(*env)->ReleaseStringUTFChars (env, endpoint, endpoint_);
(*env)->ReleaseStringUTFChars (env, public_key, public_key_);
return require_peer_;
}
JNIEXPORT jlong JNICALL
Java_org_zeromq_zyre_Zyre__1_1socket (JNIEnv *env, jclass c, jlong self)
{
@@ -289,6 +289,13 @@ public String peerHeaderValue (String peer, String name) {
return __peerHeaderValue (self, peer, name);
}
/*
Explicitly connect to a peer
*/
native static int __requirePeer (long self, String uuid, String endpoint, String publicKey);
public int requirePeer (String uuid, String endpoint, String publicKey) {
return __requirePeer (self, uuid, endpoint, publicKey);
}
/*
Return socket for talking to the Zyre node, for polling
*/
native static long __socket (long self);
@@ -197,6 +197,10 @@ char *
char *
zyre_peer_header_value (zyre_t *self, const char *peer, const char *name);
// Explicitly connect to a peer
int
zyre_require_peer (zyre_t *self, const char *uuid, const char *endpoint, const char *public_key);
// Return socket for talking to the Zyre node, for polling
zsock_t *
zyre_socket (zyre_t *self);
@@ -277,6 +277,12 @@ string my_zyre.peerHeaderValue (String, String)
Return the value of a header of a conected peer.
Returns null if peer or key doesn't exits.
```
integer my_zyre.requirePeer (String, String, String)
```
Explicitly connect to a peer
```
zsock my_zyre.socket ()
```
View
@@ -63,6 +63,7 @@ NAN_MODULE_INIT (Zyre::Init) {
Nan::SetPrototypeMethod (tpl, "peerGroups", _peer_groups);
Nan::SetPrototypeMethod (tpl, "peerAddress", _peer_address);
Nan::SetPrototypeMethod (tpl, "peerHeaderValue", _peer_header_value);
Nan::SetPrototypeMethod (tpl, "requirePeer", _require_peer);
Nan::SetPrototypeMethod (tpl, "socket", _socket);
Nan::SetPrototypeMethod (tpl, "print", _print);
Nan::SetPrototypeMethod (tpl, "version", _version);
@@ -554,6 +555,42 @@ NAN_METHOD (Zyre::_peer_header_value) {
info.GetReturnValue ().Set (Nan::New (result).ToLocalChecked ());
}
NAN_METHOD (Zyre::_require_peer) {
Zyre *zyre = Nan::ObjectWrap::Unwrap <Zyre> (info.Holder ());
char *uuid;
if (info [0]->IsUndefined ())
return Nan::ThrowTypeError ("method requires a `uuid`");
else
if (!info [0]->IsString ())
return Nan::ThrowTypeError ("`uuid` must be a string");
else {
Nan::Utf8String uuid_utf8 (info [0].As<String>());
uuid = *uuid_utf8;
}
char *endpoint;
if (info [1]->IsUndefined ())
return Nan::ThrowTypeError ("method requires a `endpoint`");
else
if (!info [1]->IsString ())
return Nan::ThrowTypeError ("`endpoint` must be a string");
else {
Nan::Utf8String endpoint_utf8 (info [1].As<String>());
endpoint = *endpoint_utf8;
}
char *public_key;
if (info [2]->IsUndefined ())
public_key = NULL;
else
if (!info [2]->IsString ())
return Nan::ThrowTypeError ("`public_key` must be a string");
else {
Nan::Utf8String public_key_utf8 (info [2].As<String>());
public_key = *public_key_utf8;
}
int result = zyre_require_peer (zyre->self, (const char *)uuid, (const char *)endpoint, (const char *)public_key);
info.GetReturnValue ().Set (Nan::New<Number>(result));
}
NAN_METHOD (Zyre::_socket) {
Zyre *zyre = Nan::ObjectWrap::Unwrap <Zyre> (info.Holder ());
zsock_t *result = zyre_socket (zyre->self);
@@ -72,6 +72,7 @@ class Zyre: public Nan::ObjectWrap {
static NAN_METHOD (_peer_groups);
static NAN_METHOD (_peer_address);
static NAN_METHOD (_peer_header_value);
static NAN_METHOD (_require_peer);
static NAN_METHOD (_socket);
static NAN_METHOD (_print);
static NAN_METHOD (_version);
@@ -130,6 +130,8 @@ class zyre_event_t(Structure):
lib.zyre_peer_address.argtypes = [zyre_p, c_char_p]
lib.zyre_peer_header_value.restype = POINTER(c_char)
lib.zyre_peer_header_value.argtypes = [zyre_p, c_char_p, c_char_p]
lib.zyre_require_peer.restype = c_int
lib.zyre_require_peer.argtypes = [zyre_p, c_char_p, c_char_p, c_char_p]
lib.zyre_socket.restype = czmq.zsock_p
lib.zyre_socket.argtypes = [zyre_p]
lib.zyre_print.restype = None
@@ -408,6 +410,12 @@ def peer_header_value(self, peer, name):
"""
return return_fresh_string(lib.zyre_peer_header_value(self._as_parameter_, peer, name))
def require_peer(self, uuid, endpoint, public_key):
"""
Explicitly connect to a peer
"""
return lib.zyre_require_peer(self._as_parameter_, uuid, endpoint, public_key)
def socket(self):
"""
Return socket for talking to the Zyre node, for polling
@@ -247,6 +247,12 @@ def peer_header_value(self, peer, name):
"""
return libzyre.zyre_peer_header_value(self._p, to_bytes(peer), to_bytes(name))
def require_peer(self, uuid, endpoint, public_key):
"""
Explicitly connect to a peer
"""
return libzyre.zyre_require_peer(self._p, to_bytes(uuid), to_bytes(endpoint), to_bytes(public_key))
def socket(self):
"""
Return socket for talking to the Zyre node, for polling
@@ -185,6 +185,10 @@ char *
char *
zyre_peer_header_value (zyre_t *self, const char *peer, const char *name);
// Explicitly connect to a peer
int
zyre_require_peer (zyre_t *self, const char *uuid, const char *endpoint, const char *public_key);
// Return socket for talking to the Zyre node, for polling
zsock_t *
zyre_socket (zyre_t *self);
@@ -4257,6 +4257,10 @@
char *
zyre_peer_header_value (zyre_t *self, const char *peer, const char *name);
// Explicitly connect to a peer
int
zyre_require_peer (zyre_t *self, const char *uuid, const char *endpoint, const char *public_key);
// Return socket for talking to the Zyre node, for polling
zsock_t *
zyre_socket (zyre_t *self);
@@ -231,6 +231,12 @@ QString QmlZyre::peerHeaderValue (const QString &peer, const QString &name) {
return retQStr_;
};
///
// Explicitly connect to a peer
int QmlZyre::requirePeer (const QString &uuid, const QString &endpoint, const QString &publicKey) {
return zyre_require_peer (self, uuid.toUtf8().data(), endpoint.toUtf8().data(), publicKey.toUtf8().data());
};
///
// Return socket for talking to the Zyre node, for polling
zsock_t *QmlZyre::socket () {
@@ -155,6 +155,9 @@ public slots:
// Returns null if peer or key doesn't exits.
QString peerHeaderValue (const QString &peer, const QString &name);
// Explicitly connect to a peer
int requirePeer (const QString &uuid, const QString &endpoint, const QString &publicKey);
// Return socket for talking to the Zyre node, for polling
zsock_t *socket ();
@@ -314,6 +314,14 @@ QString QZyre::peerHeaderValue (const QString &peer, const QString &name)
return rv;
}
///
// Explicitly connect to a peer
int QZyre::requirePeer (const QString &uuid, const QString &endpoint, const QString &publicKey)
{
int rv = zyre_require_peer (self, uuid.toUtf8().data(), endpoint.toUtf8().data(), publicKey.toUtf8().data());
return rv;
}
///
// Return socket for talking to the Zyre node, for polling
QZsock * QZyre::socket ()
@@ -92,6 +92,17 @@ def self.zyre_gossip_connect_curve(*)
attach_function :zyre_peer_groups, [:pointer], :pointer, **opts
attach_function :zyre_peer_address, [:pointer, :string], :pointer, **opts
attach_function :zyre_peer_header_value, [:pointer, :string, :string], :pointer, **opts
begin # DRAFT method
attach_function :zyre_require_peer, [:pointer, :string, :string, :string], :int, **opts
rescue ::FFI::NotFoundError
if $VERBOSE || $DEBUG
warn "The DRAFT function zyre_require_peer()" +
" is not provided by the installed zyre library."
end
def self.zyre_require_peer(*)
raise NotImplementedError, "compile zyre with --enable-drafts"
end
end
attach_function :zyre_socket, [:pointer], :pointer, **opts
attach_function :zyre_print, [:pointer], :void, **opts
attach_function :zyre_version, [], :uint64, **opts
@@ -473,6 +473,19 @@ def peer_header_value(peer, name)
result
end
# Explicitly connect to a peer
#
# @param uuid [String, #to_s, nil]
# @param endpoint [String, #to_s, nil]
# @param public_key [String, #to_s, nil]
# @return [Integer]
def require_peer(uuid, endpoint, public_key)
raise DestroyedError unless @ptr
self_p = @ptr
result = ::Zyre::FFI.zyre_require_peer(self_p, uuid, endpoint, public_key)
result
end
# Return socket for talking to the Zyre node, for polling
#
# @return [::FFI::Pointer]
View
@@ -52,6 +52,9 @@ AC_PROG_SED
AC_PROG_AWK
PKG_PROG_PKG_CONFIG
# Check endianess of the system
AC_C_BIGENDIAN
# Optional project-local hook (acinclude.m4, add AC_DEFUN([AX_PROJECT_LOCAL_HOOK], [whatever]) )
AX_PROJECT_LOCAL_HOOK
View
@@ -188,24 +188,28 @@ memcheck: src/zyre_selftest $(abs_top_builddir)/$(SELFTEST_DIR_RW) $(abs_top_bui
$(LIBTOOL) --mode=execute valgrind --tool=memcheck \
--leak-check=full --show-reachable=yes --error-exitcode=1 \
--suppressions=$(srcdir)/src/.valgrind.supp \
$(VALGRIND_OPTIONS) \
$(builddir)/src/zyre_selftest
$(MAKE) check-empty-selftest-rw
memcheck-verbose: src/zyre_selftest $(abs_top_builddir)/$(SELFTEST_DIR_RW) $(abs_top_builddir)/$(SELFTEST_DIR_RO)
$(LIBTOOL) --mode=execute valgrind --tool=memcheck \
--leak-check=full --show-reachable=yes --error-exitcode=1 \
--suppressions=$(srcdir)/src/.valgrind.supp \
$(VALGRIND_OPTIONS) \
$(builddir)/src/zyre_selftest -v
$(MAKE) check-empty-selftest-rw
# Run the selftest binary under valgrind to check for performance leaks
callcheck: src/zyre_selftest $(abs_top_builddir)/$(SELFTEST_DIR_RW) $(abs_top_builddir)/$(SELFTEST_DIR_RO)
$(LIBTOOL) --mode=execute valgrind --tool=callgrind \
$(VALGRIND_OPTIONS) \
$(builddir)/src/zyre_selftest
$(MAKE) check-empty-selftest-rw
callcheck-verbose: src/zyre_selftest $(abs_top_builddir)/$(SELFTEST_DIR_RW) $(abs_top_builddir)/$(SELFTEST_DIR_RO)
$(LIBTOOL) --mode=execute valgrind --tool=callgrind \
$(VALGRIND_OPTIONS) \
$(builddir)/src/zyre_selftest -v
$(MAKE) check-empty-selftest-rw
View
@@ -65,6 +65,11 @@ ZYRE_PRIVATE void
ZYRE_PRIVATE void
zyre_gossip_connect_curve (zyre_t *self, const char *public_key, const char *format, ...) CHECK_PRINTF (3);
// *** Draft method, defined for internal use only ***
// Explicitly connect to a peer
ZYRE_PRIVATE int
zyre_require_peer (zyre_t *self, const char *uuid, const char *endpoint, const char *public_key);
// *** Draft method, defined for internal use only ***
// Self test of this class.
ZYRE_PRIVATE void

0 comments on commit 1339cac

Please sign in to comment.