Commit 4419f476b34ef4c7843e1664039b120a208e5461

Authored by 陆恒
1 parent debfd608
Exists in master

枷锁

Showing 1 changed file with 9 additions and 0 deletions   Show diff stats
src/HttpServer/logic/logic.go
... ... @@ -14,6 +14,9 @@ import (
14 14 )
15 15  
16 16 var llock sync.Mutex
  17 +var uptasklock sync.Mutex
  18 +var gettasklock sync.Mutex
  19 +var querytasklock sync.Mutex
17 20  
18 21 func HandlerSyncuserdata(w http.ResponseWriter, data string, uniqueuuid, gameid, channel string, uuid int) {
19 22 SetHeader(w)
... ... @@ -172,6 +175,8 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uniqueuuid, gameid,
172 175  
173 176 func HandlerGettaskreward(w http.ResponseWriter, data string, uniqueuuid, gameid, channel string, uuid int) {
174 177 SetHeader(w)
  178 + gettasklock.Lock()
  179 + defer uptasklock.Unlock()
175 180 var resp GettaskrewardResp
176 181 resp.Code = 0
177 182 var rdata GettaskrewardReq
... ... @@ -228,6 +233,8 @@ func HandlerGettaskreward(w http.ResponseWriter, data string, uniqueuuid, gameid
228 233  
229 234 func HandlerQuerytaskinfo(w http.ResponseWriter, data string, uniqueuuid, gameid, channel string, uuid int) {
230 235 SetHeader(w)
  236 + querytasklock.Lock()
  237 + defer querytasklock.Unlock()
231 238 var resp QuerytaskinfoResp
232 239 resp.Code = 0
233 240 var rdata QuerytaskinfoReq
... ... @@ -291,6 +298,8 @@ func HandlerQuerytaskinfo(w http.ResponseWriter, data string, uniqueuuid, gameid
291 298  
292 299 func HandlerUpdatetaskandachieve(w http.ResponseWriter, data string, uniqueuuid, gameid, channel string, uuid int) {
293 300 SetHeader(w)
  301 + uptasklock.Lock()
  302 + defer uptasklock.Unlock()
294 303 var resp UpdatetaskResp
295 304 resp.Code = 0
296 305 var rdata UpdatetaskReq
... ...