-
Notifications
You must be signed in to change notification settings - Fork 121
Zyre binding #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wysman
wants to merge
42
commits into
zeromq:master
Choose a base branch
from
wysman:zyre
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Zyre binding #133
Changes from 4 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
c79c471
Add ZMQZyre class, a binding of the libzyre
wysman e3ad68f
Update api.h
wysman b18fec2
Add test on ZMQZyre::getSocket
wysman b35155c
Refactor ZMQZyre::getSocket
wysman 994f3ca
Display version of libs
wysman 929b108
Remove a camelcase variable
wysman f0ccd4f
Use real tabs
wysman 7bd6f6c
add zend_parse_parameters_none where missing
wysman 574d4a0
Fix returns after zend_parse_parameters
wysman fa37d9b
Use PHP_ZMQ_ZYRE_OBJECT to create this pointer
wysman 0027747
Ensure peer or groupe name are not empty
wysman cfabf10
Check for null pointers
wysman 5d74206
Set persistent_id to NULL
wysman 64d6cd1
Add test of using ZMQPoll with ZMQZyre
wysman c4be910
Add zyre tests file in the package.xml
wysman 7a2297f
Use correct filename... need a break ;)
wysman 05c5c8d
Throw exception, if group name or peer id are empty
wysman 89a3911
ecalloc, do not need null check
wysman 0955820
Fix memory leak
wysman 40ed1b5
Use zsys_version to find libczmq version at execution
wysman 2d5e18c
Add gitignore
wysman 46e7b8f
Merge remote-tracking branch 'origin/master' into zyre
wysman db12454
Display the CZMQ & Zyre librairy version, only if detected by configu…
wysman 2c2e564
Fix build if zyre is not available
wysman 104e908
Add install from bianary repo of czmq & zyre
wysman bb5f512
Reduce travis test matrix for test, will be revert
wysman b087ddb
be verbose on link creation for travis log
wysman 0ec9791
configure PKG_CONFIG_PATH in travis bootstrap
wysman c4b9fc2
typo
wysman 05f8a3f
Try direct export, configure script do not detect czmq/zyre
wysman 1f220e1
add debugs
wysman cfcc299
Test autodetection of libzmq in configure script
wysman 1a18827
Ensure the php extension build is OK, before running test
wysman 6a96e40
Pass TSRMLS_C into zhash_foreach callback
wysman 45190b8
Remove pre-installed version of zmq by travis
wysman c99745f
Be more verbose on pkg-config
wysman 141ff43
Restore with-zmq option on configure
wysman af91e6a
Test build from source for czmq/zyre ibs with the same prefix as zmq …
wysman 3ecd031
typo
wysman ae15fc2
typo
wysman 0cf5fbb
Merge branch 'master' into zyre
wysman 6ce250f
Reduce tests matrix, will be revert
wysman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
|
||
if (!extension_loaded("zmq")) die("skip"); | ||
if (!class_exists('ZMQZyre')) die('skip'); | ||
|
||
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--TEST-- | ||
Test [Zyre] Object can be instancied multiple time | ||
--SKIPIF-- | ||
<?php require_once(dirname(__FILE__) . '/skipzyre.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
$ctx = new ZMQContext; | ||
$z1 = new ZMQZyre($ctx); | ||
$z2 = new ZMQZyre($ctx); | ||
$z3 = new ZMQZyre($ctx); | ||
echo "OK"; | ||
|
||
--EXPECTF-- | ||
OK |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--TEST-- | ||
Test [Zyre] Headers are received on ENTER event | ||
--SKIPIF-- | ||
<?php require_once(dirname(__FILE__) . '/skipzyre.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
$ctx = new ZMQContext; | ||
|
||
$z1 = new ZMQZyre($ctx); | ||
$z1->setHeader('X-TEST', 'Z1'); | ||
$z1->start(); | ||
|
||
$z2 = new ZMQZyre($ctx); | ||
$z2->setHeader('X-TEST', 'Z2'); | ||
$z2->start(); | ||
|
||
usleep(100000); | ||
|
||
$obj = $z1->recv(); | ||
var_dump($obj->command); | ||
var_dump($obj->headers->{'X-TEST'}); | ||
|
||
$obj = $z2->recv(); | ||
var_dump($obj->command); | ||
var_dump($obj->headers->{'X-TEST'}); | ||
|
||
$z1->stop(); | ||
|
||
usleep(100000); | ||
|
||
$obj = $z2->recv(); | ||
var_dump($obj->command); | ||
|
||
$z2->stop(); | ||
|
||
--EXPECTF-- | ||
string(5) "ENTER" | ||
string(2) "Z2" | ||
string(5) "ENTER" | ||
string(2) "Z1" | ||
string(4) "EXIT" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--TEST-- | ||
Test [Zyre] Zyre objects can exchange data in a group of peer | ||
--SKIPIF-- | ||
<?php require_once(dirname(__FILE__) . '/skipzyre.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
$ctx = new ZMQContext; | ||
|
||
$z1 = new ZMQZyre($ctx); | ||
$z1->start(); | ||
$z1->join('ZMQZyreTestGroup'); | ||
|
||
|
||
$z2 = new ZMQZyre($ctx); | ||
$z2->start(); | ||
$z2->join('ZMQZyreTestGroup'); | ||
|
||
|
||
usleep(100000); | ||
|
||
// Enter | ||
$obj = $z1->recv(); | ||
var_dump($obj->command); | ||
|
||
// Join | ||
$obj = $z1->recv(); | ||
var_dump($obj->command); | ||
var_dump($obj->group); | ||
|
||
// Enter | ||
$obj = $z2->recv(); | ||
var_dump($obj->command); | ||
|
||
// Join | ||
$obj = $z2->recv(); | ||
var_dump($obj->command); | ||
var_dump($obj->group); | ||
|
||
$z2->sendGroup('ZMQZyreTestGroup', 'Some usefull data'); | ||
|
||
usleep(100000); | ||
|
||
// SHOUT | ||
$obj = $z1->recv(); | ||
var_dump($obj->group); | ||
var_dump($obj->data); | ||
|
||
$z1->leave('ZMQZyreTestGroup'); | ||
|
||
usleep(100000); | ||
|
||
// Leave | ||
$obj = $z2->recv(); | ||
var_dump($obj->command); | ||
var_dump($obj->group); | ||
|
||
$z1->stop(); | ||
|
||
usleep(100000); | ||
|
||
// Exit | ||
$obj = $z2->recv(); | ||
var_dump($obj->command); | ||
|
||
$z2->stop(); | ||
|
||
--EXPECTF-- | ||
string(5) "ENTER" | ||
string(4) "JOIN" | ||
string(16) "ZMQZyreTestGroup" | ||
string(5) "ENTER" | ||
string(4) "JOIN" | ||
string(16) "ZMQZyreTestGroup" | ||
string(16) "ZMQZyreTestGroup" | ||
string(17) "Some usefull data" | ||
string(5) "LEAVE" | ||
string(16) "ZMQZyreTestGroup" | ||
string(4) "EXIT" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--TEST-- | ||
Test [Zyre] Zyre objects can exchange data with a peer | ||
--SKIPIF-- | ||
<?php require_once(dirname(__FILE__) . '/skipzyre.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
$ctx = new ZMQContext; | ||
|
||
$z1 = new ZMQZyre($ctx); | ||
$z1->start(); | ||
|
||
$z2 = new ZMQZyre($ctx); | ||
$z2->start(); | ||
|
||
usleep(100000); | ||
|
||
// Enter | ||
$obj = $z1->recv(); | ||
var_dump($obj->command); | ||
|
||
// Enter | ||
$obj = $z2->recv(); | ||
var_dump($obj->command); | ||
$peer = $obj->peer; | ||
|
||
$z2->sendPeer($peer, 'Some very usefull data'); | ||
|
||
usleep(100000); | ||
|
||
// SHOUT | ||
$obj = $z1->recv(); | ||
var_dump($obj->data); | ||
|
||
$z1->stop(); | ||
|
||
usleep(100000); | ||
|
||
// Exit | ||
$obj = $z2->recv(); | ||
var_dump($obj->command); | ||
|
||
$z2->stop(); | ||
|
||
--EXPECTF-- | ||
string(5) "ENTER" | ||
string(5) "ENTER" | ||
string(22) "Some very usefull data" | ||
string(4) "EXIT" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this member camelcase and the rest are underscore?