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
59723377
Commit
59723377
authored
May 08, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
dc719b5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
go/xcommon/xnet/lonet/registry_sqlite.go
go/xcommon/xnet/lonet/registry_sqlite.go
+12
-9
No files found.
go/xcommon/xnet/lonet/registry_sqlite.go
View file @
59723377
...
...
@@ -22,6 +22,7 @@ package lonet
import
(
"context"
"errors"
"crawshaw.io/sqlite"
"crawshaw.io/sqlite/sqliteutil"
...
...
@@ -130,6 +131,8 @@ func (r *sqliteRegistry) Announce(ctx context.Context, hostname, osladdr string)
return
err
}
var
errRegDup
=
errors
.
New
(
"registry broken: duplicate host entries"
)
func
(
r
*
sqliteRegistry
)
Query
(
ctx
context
.
Context
,
hostname
string
)
(
osladdr
string
,
err
error
)
{
defer
r
.
regerr
(
&
err
,
"query"
,
hostname
)
...
...
@@ -144,23 +147,23 @@ func (r *sqliteRegistry) Query(ctx context.Context, hostname string) (osladdr st
}
defer
r
.
dbpool
.
Put
(
conn
)
nrow
:=
0
err
=
sqliteutil
.
Exec
(
conn
,
"SELECT osladdr FROM hosts WHERE hostname = ?"
,
func
(
stmt
*
sqlite
.
Stmt
)
error
{
osladdr
=
stmt
.
ColumnText
(
0
)
nrow
++
return
nil
})
/* XXX reenable
switch sqlite.ErrCode(err) {
case sqlite.XXXNOROW:
err = errNoHost
}
*/
/*
if
err
!=
nil
{
return
""
,
err
}
*/
if
nrow
==
0
{
return
""
,
errNoHost
}
else
if
nrow
>
1
{
// hostname is PK - we should not get several results
return
""
,
errRegDup
}
return
osladdr
,
err
}
...
...
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