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

basic ID cmd #255

Merged
merged 4 commits into from
Nov 18, 2014
Merged

basic ID cmd #255

merged 4 commits into from
Nov 18, 2014

Conversation

whyrusleeping
Copy link
Member

The ID command I implemented here doesnt have all the information that @jbenet mentioned he would like to have in #228, I wasnt sure how to access the version information without using the config (we wont be able to get configs from remote peers)

@whyrusleeping whyrusleeping added the status/in-progress In progress label Nov 3, 2014
@whyrusleeping whyrusleeping changed the title basic Id cmd basic ID cmd Nov 3, 2014
@whyrusleeping whyrusleeping added this to the α milestone Nov 3, 2014
@jbenet
Copy link
Member

jbenet commented Nov 3, 2014

@whyrusleeping we get the version information on handshake1.

We should be able to request resending the information on handshake1 and handshake3, and implement peer <id> that way (we send a msg requesting this info, they reply, and we print it out).

@jbenet
Copy link
Member

jbenet commented Nov 3, 2014

(or, when we connect to a peer, we store it in the peer.Peer object. So, if (we're not connected to them, we try connecting) we have it around in the peer.Peer object we print it.

@jbenet
Copy link
Member

jbenet commented Nov 5, 2014

Needs some locking, and travis failed. rebase, and otherwise LGTM!!

} else if p.privKey != nil {
return p.privKey.GetPublic()
}
return nil
Copy link
Member

Choose a reason for hiding this comment

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

nono let's not do this because we dont want to have to compute it every time. We could move to this:

    if p.pubKey == nil && p.privKey != nil {
        p.pubKey = p.privKey.GetPublic()
    }
    return p.pubKey

but did you actually fall into this case?

Copy link
Member Author

Choose a reason for hiding this comment

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

I dont know if ive seen it occur, but it feels like the common sense thing to do

Copy link
Member

Choose a reason for hiding this comment

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

sure. switch it to mine, so we store the new value

@jbenet
Copy link
Member

jbenet commented Nov 6, 2014

@whyrusleeping LGTM. Merging nope. problems.

@jbenet
Copy link
Member

jbenet commented Nov 6, 2014

Panic on simply testing it.

Protocol changes like this will mean talking to nodes like mars, which don't currently have this change. Clients should not panic.

% ipfs bootstrap
/ip4/104.131.131.82/tcp/4001/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
/ip4/185.44.107.170/tcp/4001/QmaA6Bw7TDCaGPPLCCWZgkWyy2JUU6bNEyyoe5jsP32hU8
% ipfs id QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x5e9ae]

goroutine 16 [running]:
runtime.panic(0x568a20, 0x928664)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/panic.c:279 +0xf5
github.com/jbenet/go-ipfs/core/commands.GetID(0xc208062d80, 0xc20800e020, 0x1, 0x1, 0xc20808c1b0, 0xa633f0, 0xc20803c008, 0x0, 0x0)
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/core/commands/id.go:25 +0x1de
main.func·007(0x9243e0, 0xc20800e020, 0x1, 0x1, 0x0, 0x0)
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/cmd/ipfs/gen.go:68 +0x7fb
github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander.(*Command).Dispatch(0x9243e0, 0xc20800e020, 0x1, 0x1, 0x0, 0x0)
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander/commands.go:221 +0x75c
github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander.(*Command).Dispatch(0x926360, 0xc20800e010, 0x2, 0x2, 0x0, 0x0)
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander/commands.go:187 +0x228
main.main()
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/cmd/ipfs/ipfs.go:116 +0x203

goroutine 19 [finalizer wait]:
runtime.park(0x1f8a0, 0x92c830, 0x92a729)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x92c830, 0x92a729)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
    /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
    /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/proc.c:1445

goroutine 20 [syscall]:
os/signal.loop()
    /usr/local/Cellar/go/1.3/libexec/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
    /usr/local/Cellar/go/1.3/libexec/src/pkg/os/signal/signal_unix.go:27 +0x32

goroutine 27 [chan receive]:
github.com/jbenet/go-ipfs/util/ctxcloser.(*contextCloser).closeOnContextDone(0xc208005b00)
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/util/ctxcloser/closer.go:180 +0x69
created by github.com/jbenet/go-ipfs/util/ctxcloser.NewContextCloser
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/util/ctxcloser/closer.go:124 +0x11e

goroutine 25 [IO wait]:
net.runtime_pollWait(0xa64f70, 0x72, 0x0)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/netpoll.goc:146 +0x66
net.(*pollDesc).Wait(0xc2080278e0, 0x72, 0x0, 0x0)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(*pollDesc).WaitRead(0xc2080278e0, 0x0, 0x0)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(*netFD).Read(0xc208027880, 0xc20831c800, 0x800, 0x800, 0x0, 0xa63290, 0x23)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/net/fd_unix.go:232 +0x34c
net.(*conn).Read(0xc20803c0d0, 0xc20831c800, 0x800, 0x800, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/net/net.go:122 +0xe7
crypto/tls.(*block).readFromUntil(0xc20800f650, 0xa65070, 0xc20803c0d0, 0x5, 0x0, 0x0)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/crypto/tls/conn.go:451 +0xd9
crypto/tls.(*Conn).readRecord(0xc208010840, 0x17, 0x0, 0x0)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/crypto/tls/conn.go:536 +0x1ff
crypto/tls.(*Conn).Read(0xc208010840, 0xc20807c000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/crypto/tls/conn.go:901 +0x16a
net/http.noteEOFReader.Read(0xa6e098, 0xc208010840, 0xc20805a7e8, 0xc20807c000, 0x1000, 0x1000, 0x940320, 0x0, 0x0)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:1203 +0x72
net/http.(*noteEOFReader).Read(0xc20825fb20, 0xc20807c000, 0x1000, 0x1000, 0xc208055490, 0x0, 0x0)
    <autogenerated>:124 +0xca
bufio.(*Reader).fill(0xc208005680)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/bufio/bufio.go:97 +0x1b3
bufio.(*Reader).Peek(0xc208005680, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/bufio/bufio.go:132 +0x101
net/http.(*persistConn).readLoop(0xc20805a790)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:782 +0x95
created by net/http.(*Transport).dialConn
    /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:600 +0x93f

goroutine 17 [syscall]:
runtime.goexit()
    /usr/local/Cellar/go/1.3/libexec/src/pkg/runtime/proc.c:1445

goroutine 26 [select]:
net/http.(*persistConn).writeLoop(0xc20805a790)
    /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:885 +0x38f
created by net/http.(*Transport).dialConn
    /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:601 +0x957

goroutine 28 [select]:
github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util.(*BufferPool).drain(0xc208307260)
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go:173 +0x1b4
created by github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util.NewBufferPool
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go:203 +0x202

goroutine 29 [select]:
github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.(*DB).compactionError(0xc2082c8900)
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_compaction.go:113 +0x1fa
created by github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.openDB
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:123 +0x4d6

goroutine 30 [select]:
github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.(*DB).tCompaction(0xc2082c8900)
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_compaction.go:667 +0x777
created by github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.openDB
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:126 +0x518

goroutine 31 [select]:
github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.(*DB).mCompaction(0xc2082c8900)
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_compaction.go:616 +0x1b9
created by github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.openDB
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:127 +0x530

goroutine 33 [select]:
github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.(*DB).jWriter(0xc2082c8900)
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_write.go:37 +0x143
created by github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.openDB
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:128 +0x548

goroutine 34 [select]:
github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.(*DB).mpoolDrain(0xc2082c8900)
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_state.go:73 +0xfb
created by github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.openDB
    /Users/jbenet/go/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:129 +0x560

@jbenet
Copy link
Member

jbenet commented Nov 6, 2014

And: daemon: id: Invalid Command: 'id' daemon.go:151

@maybebtc do you want new commands not to be added until #263 lands?

@jbenet
Copy link
Member

jbenet commented Nov 6, 2014

Also, ipfs id doesnt seem to output my addresses. (this is probably my fault as the listen address no longer gets added to the peer until the swarm is listening).

% ipfs config Addresses
{
  "API": "/ip4/127.0.0.1/tcp/5001",
  "Swarm": "/ip4/0.0.0.0/tcp/4001"
}
% ipfs id
{
    "Addresses": [
        {}
    ],
    "AgentVersion": "go-ipfs/0.1.5",
    "ID": "Qmcrp1uV8Na1hE1VWdhMWmmfTLMrChyNZWgTBJCn7cKBtz",
    "ProtocolVersion": "0.0.1",
    "PublicKey": "CAASpgQwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDFUuhYNLYKPkjIEcEomfFydwmfkhncwuAbmjC4rXT6vrWCHfmtBDOWi3+8YJYKTYUocymzK1GxxV1uPdiMW9+LISev414dCqT3mnugy/1KhsJvKTR2fwtxkp4u3/HobGAlR0NUWKgDTASZ4xTmDPQah+bUSWD4aAb7HY8tqeEsqwMXnljDs9j/V9zoZrHEUohYi/rvniOyEq618CLt5ctyGqvLng01Cv0NjEal94wNAhzeckbCwwH08TJircyQnOSgqESOcpzTdESjcYynpplBnSJbSptOiAMf+Si6Br/LYaCjR9KXNegusSc10DA2komz2grNT4yB+QLunlI76QzLAv8kmrGrJUq0/oamoG5HRnARd7IrHVGkyd+HW0r0ycj98jCCpL46b829Am8qXVlEUQ6H/ap3V8mdhC+Pp1NWzCYgLbNXgUccpxhRXn1d0ZPXRs40jq+oZ3B5JsMyLS2fgFazl+UKlWYpyt3i07PM8r/F/B6SfrQLtIEt9LXcRBO5R/n7ncAkawT2DfS/KndCNid+CecxPVB9K/kkY0f9DvXx2nnG0zE6tVYjNms9M4vlTRawmxLEjnPDfCm7Eti+3G+F16W9V1ZxsJKR5DefQAOqQeAb79WZSIUFdZdEerUWDfW2x7jhokyHu5F7m5NCGcqM4qtYkuEq9O6QrW9CCQIDAQAB"
}

@jbenet
Copy link
Member

jbenet commented Nov 6, 2014

btw, this cmd is really great! it makes the system much more tangible

@btc
Copy link
Contributor

btc commented Nov 6, 2014

@jbenet
May as well implement new commands in the new package. Not really seeing a benefit to adding new commands to something that's about to be buried deep into the git archives.

@jbenet
Copy link
Member

jbenet commented Nov 6, 2014

@maybebtc ok

this cmd will have to wait then, as it currently panics. (n.Routing is nil when there's no daemon. and when there's a daemon, id isnt a cmd). :(

cc @whyrusleeping

@whyrusleeping
Copy link
Member Author

Should I migrate this over to the new commands system? Or wait until the PR lands?

@btc
Copy link
Contributor

btc commented Nov 9, 2014

the PR is pretty big, but it wouldn't really hurt.

@jbenet
Copy link
Member

jbenet commented Nov 16, 2014

@whyrusleeping ok this one is finally unblocked! 👍

@whyrusleeping
Copy link
Member Author

Alright, should be properly ported over to commands2

@jbenet
Copy link
Member

jbenet commented Nov 17, 2014

@whyrusleeping travis doesnt like you.

Also, maybe add a sharness test?

@whyrusleeping
Copy link
Member Author

lol, travis failed because a bitswap test timed out, the stack trace shows over 500 goroutines spawned by that pubsub library we are using..

@btc
Copy link
Contributor

btc commented Nov 18, 2014

lol, travis failed because a bitswap test timed out, the stack trace shows over 500 goroutines spawned by that pubsub library we are using..

In that test there are 500 bitswap instances each waiting for 1 key.

jbenet added a commit that referenced this pull request Nov 18, 2014
@jbenet jbenet merged commit f47b4f1 into master Nov 18, 2014
@jbenet jbenet removed the status/in-progress In progress label Nov 18, 2014
@jbenet jbenet deleted the id-cmd branch November 18, 2014 07:23
@jbenet
Copy link
Member

jbenet commented Nov 18, 2014

@whyrusleeping i merged this in and it doesn't work :/ need to specify arguments

% ipfs2 id QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
Error: Expected 0 arguments, got 1

@jbenet
Copy link
Member

jbenet commented Nov 18, 2014

Fixed in: 21d2838

@whyrusleeping
Copy link
Member Author

Ah, i guess i didnt really understand how that part of the commands worked.

ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this pull request Oct 23, 2021
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