File tree 3 files changed +16
-0
lines changed
3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ func AllMids() map[string]cgrpc.OutsideHandler {
19
19
return all
20
20
}
21
21
22
+ //thread unsafe
23
+ func RegMid (name string , handler cgrpc.OutsideHandler ) {
24
+ all [name ] = handler
25
+ }
22
26
func rate (ctx * cgrpc.Context ) {
23
27
if ! publicmids .GrpcRate (ctx .GetPath ()) {
24
28
ctx .Abort (cerror .ErrLimit )
Original file line number Diff line number Diff line change @@ -18,6 +18,12 @@ func init() {
18
18
func AllMids () map [string ]crpc.OutsideHandler {
19
19
return all
20
20
}
21
+
22
+ //thread unsafe
23
+ func RegMid (name string , handler crpc.OutsideHandler ) {
24
+ all [name ] = handler
25
+ }
26
+
21
27
func rate (ctx * crpc.Context ) {
22
28
if ! publicmids .CrpcRate (ctx .GetPath ()) {
23
29
ctx .Abort (cerror .ErrLimit )
Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ func init() {
20
20
func AllMids () map [string ]web.OutsideHandler {
21
21
return all
22
22
}
23
+
24
+ //thread unsafe
25
+ func RegMid (name string , handler web.OutsideHandler ) {
26
+ all [name ] = handler
27
+ }
28
+
23
29
func rate (ctx * web.Context ) {
24
30
switch ctx .GetMethod () {
25
31
case http .MethodGet :
You can’t perform that action at this time.
0 commit comments