Skip to content

Commit 00c7da3

Browse files
author
chenjie
committed
update
1 parent df07a5d commit 00c7da3

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

cgrpc/mids/mids.go

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ func AllMids() map[string]cgrpc.OutsideHandler {
1919
return all
2020
}
2121

22+
//thread unsafe
23+
func RegMid(name string, handler cgrpc.OutsideHandler) {
24+
all[name] = handler
25+
}
2226
func rate(ctx *cgrpc.Context) {
2327
if !publicmids.GrpcRate(ctx.GetPath()) {
2428
ctx.Abort(cerror.ErrLimit)

crpc/mids/mids.go

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ func init() {
1818
func AllMids() map[string]crpc.OutsideHandler {
1919
return all
2020
}
21+
22+
//thread unsafe
23+
func RegMid(name string, handler crpc.OutsideHandler) {
24+
all[name] = handler
25+
}
26+
2127
func rate(ctx *crpc.Context) {
2228
if !publicmids.CrpcRate(ctx.GetPath()) {
2329
ctx.Abort(cerror.ErrLimit)

web/mids/mids.go

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ func init() {
2020
func AllMids() map[string]web.OutsideHandler {
2121
return all
2222
}
23+
24+
//thread unsafe
25+
func RegMid(name string, handler web.OutsideHandler) {
26+
all[name] = handler
27+
}
28+
2329
func rate(ctx *web.Context) {
2430
switch ctx.GetMethod() {
2531
case http.MethodGet:

0 commit comments

Comments
 (0)