Skip to content
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

ipc command & native control interface #54

Merged
merged 2 commits into from Jan 7, 2019

Conversation

3 participants
@jrhea
Copy link

commented Dec 21, 2018

This PR simply packages the libp2p-dameon as a shared object and exposes a simple native control interface with two methods:

  • startDaemon(config)
  • stopDaemon()

The control interface is still managed via IPC

beacon chain libp2p interface design option 2

Build Instructions:

# build everything
$ make all
# build go daemon
$ make deps && make go-daemon
# build java daemon
$ make deps && make java-daemon
# only build the daemon control shared object 
$ make deps && make daemon-control-so

Run the daemon from Java

$ cd bindings && java p2pd
Control socket: /tmp/p2pd.sock
Peer ID: Qmb3mEWb7JGBxzduizmFnzQ14uYaqsFqmsCU4tssMRY3rT
Peer Addrs:
/ip6/::1/tcp/61459
/p2p-circuit
/ip4/127.0.0.1/tcp/61458
/ip4/192.168.1.129/tcp/61458
/ip4/192.168.2.65/tcp/61458 

Run the daemon from Go

$ p2pd --sock=/tmp/p2pd2.sock
Control socket: /tmp/p2pd2.sock
Peer ID: Qmbr1NfbBMAzhWTxsJUYu1oXXHhSVRx9BW13qR8uMXuhio
Peer Addrs:
/ip6/::1/tcp/59344
/p2p-circuit
/ip4/127.0.0.1/tcp/59343
/ip4/192.168.1.129/tcp/59343
/ip4/192.168.2.65/tcp/59343
@vyzo

vyzo approved these changes Dec 21, 2018

Copy link
Collaborator

left a comment

LGTM

@vyzo vyzo requested review from bigs and raulk Dec 21, 2018

changing name of Makefile rule: daemon-shared-object to daemon-contro…
…l-so. Also, added .DS_Store to .gitignore
@jrhea

This comment has been minimized.

Copy link
Author

commented Jan 3, 2019

Can this be merged into the base branch?

@jrhea

This comment has been minimized.

Copy link
Author

commented Jan 7, 2019

^ @raulk

@raulk

This comment has been minimized.

Copy link
Member

commented Jan 7, 2019

I see no reason why not to, and @vyzo has already LGTM’d. As we continue hacking on this, there’ll be opportunities to revisit if needed. I’ll just go ahead and merge.

Sorry for the delay – Santa and the Three Wise Kings called.

@raulk

raulk approved these changes Jan 7, 2019

Copy link
Member

left a comment

@jrhea – this looks pretty good \o/

We can close #28, as that former PR is now being splintered according to the plan, right?

@@ -54,6 +57,15 @@ func NewDaemon(ctx context.Context, path string, opts ...libp2p.Option) (*Daemon

go d.listen()

sigc := make(chan os.Signal, 1)
signal.Notify(sigc, os.Interrupt, syscall.SIGTERM)
go func(ln net.Listener, c chan os.Signal) {

This comment has been minimized.

Copy link
@raulk

raulk Jan 7, 2019

Member

Nice one for an orderly shutdown.

)

// DaemonConfig defines the configuration options
type DaemonConfig struct {

This comment has been minimized.

Copy link
@raulk

raulk Jan 7, 2019

Member

Eventually I'd like us to bring in some grouping/organisation to the daemon config, but definitely not a showstopper here. See related: #35.

@raulk raulk merged commit 38883c2 into libp2p:native-api Jan 7, 2019

1 check failed

continuous-integration/jenkins/pr-merge This commit has test failures
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.