File tree Expand file tree Collapse file tree 3 files changed +23
-9
lines changed Expand file tree Collapse file tree 3 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,27 @@ func (s *Server) Go(id interface{}, args ...interface{}) {
149
149
}
150
150
}
151
151
152
+ // goroutine safe
153
+ func (s * Server ) Call0 (id interface {}, args ... interface {}) error {
154
+ c := NewClient (0 )
155
+ c .Attach (s )
156
+ return c .Call0 (id , args ... )
157
+ }
158
+
159
+ // goroutine safe
160
+ func (s * Server ) Call1 (id interface {}, args ... interface {}) (interface {}, error ) {
161
+ c := NewClient (0 )
162
+ c .Attach (s )
163
+ return c .Call1 (id , args ... )
164
+ }
165
+
166
+ // goroutine safe
167
+ func (s * Server ) CallN (id interface {}, args ... interface {}) ([]interface {}, error ) {
168
+ c := NewClient (0 )
169
+ c .Attach (s )
170
+ return c .CallN (id , args ... )
171
+ }
172
+
152
173
func (s * Server ) Close () {
153
174
close (s .ChanCall )
154
175
@@ -159,13 +180,6 @@ func (s *Server) Close() {
159
180
}
160
181
}
161
182
162
- // goroutine safe
163
- func (s * Server ) Open (l int ) * Client {
164
- c := NewClient (l )
165
- c .Attach (s )
166
- return c
167
- }
168
-
169
183
func NewClient (l int ) * Client {
170
184
c := new (Client )
171
185
c .chanSyncRet = make (chan * RetInfo , 1 )
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ func (c *ExternalCommand) run(_args []string) string {
46
46
args [i ] = v
47
47
}
48
48
49
- ret , err := c .server .Open ( 0 ). Call1 (c ._name , args ... )
49
+ ret , err := c .server .Call1 (c ._name , args ... )
50
50
if err != nil {
51
51
return err .Error ()
52
52
}
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ func (a *agent) Run() {
109
109
110
110
func (a * agent ) OnClose () {
111
111
if a .gate .AgentChanRPC != nil {
112
- err := a .gate .AgentChanRPC .Open ( 0 ). Call0 ("CloseAgent" , a )
112
+ err := a .gate .AgentChanRPC .Call0 ("CloseAgent" , a )
113
113
if err != nil {
114
114
log .Error ("chanrpc error: %v" , err )
115
115
}
You can’t perform that action at this time.
0 commit comments