Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
ef5e0a40
Commit
ef5e0a40
authored
Dec 01, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3ec038b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
13 deletions
+10
-13
t/neo/connection.go
t/neo/connection.go
+10
-11
t/neo/storage.go
t/neo/storage.go
+0
-2
No files found.
t/neo/connection.go
View file @
ef5e0a40
...
...
@@ -60,11 +60,17 @@ type Conn struct {
rxq
chan
Pkt
// XXX chan &Pkt ?
}
// Buffer with packet data
type
PktBuf
struct
{
PktHead
Body
[]
byte
}
// Send packet via connection
// XXX vs cancel
func
(
Conn
*
c
)
Send
(
pkt
Pkt
)
error
{
pkt
.
MsgId
=
...
// TODO next msgid, or using same msgid as received
pkt
.
MsgId
=
0
// TODO next msgid, or using same msgid as received
_
,
err
:=
c
.
nodeLink
.
peerLink
.
Write
(
pkt
.
WholeBuffer
())
// TODO -> sendPkt(pkt)
if
err
!=
nil
{
// TODO data could be written partially and thus the message stream is now broken
...
...
@@ -76,7 +82,7 @@ func (Conn *c) Send(pkt Pkt) error {
// Receive packet from connection
// XXX vs cancel
func
(
Conn
*
c
)
Recv
()
(
PktBuf
,
error
)
{
pkt
,
ok
<-
rxq
pkt
,
ok
:=
<-
rxq
if
!
ok
{
return
PktBuf
{},
io
.
EOF
// XXX check erroring & other errors?
}
...
...
@@ -108,7 +114,7 @@ func NewNodeLink(c net.Conn) *NodeLink {
func
(
nl
*
NodeLink
)
NewConn
()
*
Conn
{
c
:=
&
Conn
{
nodeLink
:
nl
,
rxq
:
make
(
chan
Pkt
)}
// XXX locking
nl
.
connTab
[
...
]
=
c
//
XXX also check not a duplicate
nl
.
connTab
[
0
]
=
c
// FIXME 0 -> msgid;
XXX also check not a duplicate
return
c
}
...
...
@@ -135,7 +141,7 @@ func (nl *NodeLink) serveRecv() error {
continue
}
conn
=
nl
.
NewConn
(
...
)
// XXX should also update connTab
conn
=
nl
.
NewConn
(
)
// TODO avoid spawning goroutine for each new Ask request -
// - by keeping pool of read inactive goroutine / conn pool
go
nl
.
handleNewConn
(
conn
)
...
...
@@ -153,13 +159,6 @@ func (nl *NodeLink) HandleNewConn(h func(*Conn)) {
}
// information about (received ?) packet
// XXX place?
type
PktBuf
struct
{
PktHead
Body
[]
byte
}
// receive 1 packet from peer
func
(
c
*
NodeLink
)
recvPkt
()
(
pkt
Pkt
,
err
error
)
{
// TODO organize rx buffers management (freelist etc)
...
...
t/neo/storage.go
View file @
ef5e0a40
...
...
@@ -4,10 +4,8 @@ package neo
import
(
"context"
"encoding/binary"
"net"
"fmt"
"io"
//"../neo/proto"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment