Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
go-routeros
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SR
go-routeros
Commits
5f65e390
Commit
5f65e390
authored
Jul 24, 2016
by
André Luiz dos Santos
Browse files
Options
Downloads
Patches
Plain Diff
Unexport Client.Mutex
parent
5aea8396
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
async.go
+8
-8
8 additions, 8 deletions
async.go
client.go
+1
-1
1 addition, 1 deletion
client.go
listen.go
+2
-2
2 additions, 2 deletions
listen.go
run.go
+2
-2
2 additions, 2 deletions
run.go
with
13 additions
and
13 deletions
async.go
+
8
−
8
View file @
5f65e390
...
...
@@ -12,8 +12,8 @@ type replyCloser interface {
// Async starts asynchronous mode and returns immediately.
func
(
c
*
Client
)
Async
()
<-
chan
error
{
c
.
Lock
()
defer
c
.
Unlock
()
c
.
mu
.
Lock
()
defer
c
.
mu
.
Unlock
()
errC
:=
make
(
chan
error
,
1
)
if
c
.
async
{
...
...
@@ -45,26 +45,26 @@ func (c *Client) asyncLoop() error {
return
err
}
c
.
Lock
()
c
.
mu
.
Lock
()
r
,
ok
:=
c
.
tags
[
sen
.
Tag
]
c
.
Unlock
()
c
.
mu
.
Unlock
()
if
!
ok
{
continue
}
done
,
err
:=
r
.
processSentence
(
sen
)
if
done
||
err
!=
nil
{
c
.
Lock
()
c
.
mu
.
Lock
()
delete
(
c
.
tags
,
sen
.
Tag
)
c
.
Unlock
()
c
.
mu
.
Unlock
()
closeReply
(
r
,
err
)
}
}
}
func
(
c
*
Client
)
closeTags
(
err
error
)
{
c
.
Lock
()
defer
c
.
Unlock
()
c
.
mu
.
Lock
()
defer
c
.
mu
.
Unlock
()
for
_
,
r
:=
range
c
.
tags
{
closeReply
(
r
,
err
)
...
...
This diff is collapsed.
Click to expand it.
client.go
+
1
−
1
View file @
5f65e390
...
...
@@ -27,7 +27,7 @@ type Client struct {
async
bool
nextTag
int64
tags
map
[
string
]
sentenceProcessor
sync
.
Mutex
mu
sync
.
Mutex
}
// NewClient returns a new Client over rwc. Login must be called.
...
...
This diff is collapsed.
Click to expand it.
listen.go
+
2
−
2
View file @
5f65e390
...
...
@@ -53,8 +53,8 @@ func (c *Client) ListenArgsQueue(sentence []string, queueSize int) (*ListenReply
}
c
.
w
.
WriteWord
(
".tag="
+
l
.
tag
)
c
.
Lock
()
defer
c
.
Unlock
()
c
.
mu
.
Lock
()
defer
c
.
mu
.
Unlock
()
err
:=
c
.
w
.
EndSentence
()
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
run.go
+
2
−
2
View file @
5f65e390
...
...
@@ -49,8 +49,8 @@ func (c *Client) endCommandAsync() (*asyncReply, error) {
a
.
tag
=
fmt
.
Sprintf
(
"r%d"
,
c
.
nextTag
)
c
.
w
.
WriteWord
(
".tag="
+
a
.
tag
)
c
.
Lock
()
defer
c
.
Unlock
()
c
.
mu
.
Lock
()
defer
c
.
mu
.
Unlock
()
err
:=
c
.
w
.
EndSentence
()
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment