Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
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
Stefane Fermigier
neo
Commits
04b2b074
Commit
04b2b074
authored
Jun 02, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b1e8b102
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
7 deletions
+26
-7
go/xcommon/pipenet/pipenet.go
go/xcommon/pipenet/pipenet.go
+26
-7
No files found.
go/xcommon/pipenet/pipenet.go
View file @
04b2b074
...
...
@@ -101,6 +101,11 @@ func (e *entry) empty() bool {
return
e
.
pipev
[
0
]
==
nil
&&
e
.
pipev
[
1
]
==
nil
&&
e
.
listener
==
nil
}
// addr returns address corresponding to entry
func
(
e
*
entry
)
addr
()
*
Addr
{
return
&
Addr
{
network
:
e
.
network
.
netname
(),
addr
:
fmt
.
Sprintf
(
"%d"
,
e
.
port
)}
}
func
(
a
*
Addr
)
Network
()
string
{
return
a
.
network
}
func
(
a
*
Addr
)
String
()
string
{
return
a
.
addr
}
// XXX Network() + ":" + a.addr ?
func
(
n
*
Network
)
netname
()
string
{
return
NetPrefix
+
n
.
Name
}
...
...
@@ -231,15 +236,12 @@ func (n *Network) Dial(addr string) (net.Conn, error) {
// Addr returns address where listener is accepting incoming connections
func
(
l
*
listener
)
Addr
()
net
.
Addr
{
e
:=
l
.
entry
n
:=
e
.
network
return
&
Addr
{
network
:
n
.
netname
(),
addr
:
fmt
.
Sprintf
(
"%d"
,
e
.
port
)}
// NOTE no c/s XXX -> +l ?
// NOTE no +"l" suffix e.g. because Dial(l.Addr()) must work
return
l
.
entry
.
addr
()
}
// XXX conn.Close - unregister from network.connv
// XXX conn.LocalAddr -> ...
// XXX conn.RemoteAddr -> ...
// Close closes pipe endpoint and unregisters conn from Network
// All currently in-flight blocking IO is interuppted with an error
func
(
c
*
conn
)
Close
()
(
err
error
)
{
c
.
closeOnce
.
Do
(
func
()
{
err
=
c
.
Conn
.
Close
()
...
...
@@ -260,6 +262,23 @@ func (c *conn) Close() (err error) {
return
err
}
// LocalAddr returns address of local end of connection
// it is entry address + "c" (client) or "s" (server) suffix depending on
// whether pipe endpoint was created via Dial or Accept.
func
(
c
*
conn
)
LocalAddr
()
net
.
Addr
{
addr
:=
c
.
entry
.
addr
()
addr
.
addr
+=
string
(
"cs"
[
c
.
endpoint
])
return
addr
}
// RemoteAddr returns address of remote end of connection
// it is entry address + "c" or "s" suffix -- see LocalAddr for details
func
(
c
*
conn
)
RemoteAddr
()
net
.
Addr
{
addr
:=
c
.
entry
.
addr
()
addr
.
addr
+=
string
(
"sc"
[
c
.
endpoint
])
return
addr
}
...
...
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