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

jrhea
Copy link

@jrhea jrhea 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

Copy link
Collaborator

@vyzo vyzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vyzo vyzo requested review from bigs and raulk December 21, 2018 08:37
@jrhea
Copy link
Author

jrhea commented Jan 3, 2019

Can this be merged into the base branch?

@jrhea
Copy link
Author

jrhea commented Jan 7, 2019

^ @raulk

@raulk
Copy link
Member

raulk 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.

Copy link
Member

@raulk raulk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one for an orderly shutdown.

)

// DaemonConfig defines the configuration options
type DaemonConfig struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants