avoid races when sending requests
This commit is contained in:
parent
4e3feffaad
commit
204657b38b
2 changed files with 96 additions and 144 deletions
|
@ -16,15 +16,14 @@ func (r *AcceptInvitationRequest) Submit(conn *signald.Signald) (response JsonGr
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -49,15 +48,14 @@ func (r *AddLinkedDeviceRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -75,15 +73,14 @@ func (r *AddServerRequest) Submit(conn *signald.Signald) (response string, err e
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -108,15 +105,14 @@ func (r *ApproveMembershipRequest) Submit(conn *signald.Signald) (response JsonG
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -140,15 +136,14 @@ func (r *CreateGroupRequest) Submit(conn *signald.Signald) (response JsonGroupV2
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -173,15 +168,14 @@ func (r *DeleteAccountRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -198,15 +192,14 @@ func (r *RemoveServerRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -224,15 +217,14 @@ func (r *FinishLinkRequest) Submit(conn *signald.Signald) (response Account, err
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -257,15 +249,14 @@ func (r *GenerateLinkingURIRequest) Submit(conn *signald.Signald) (response Link
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -290,15 +281,14 @@ func (r *GetAllIdentities) Submit(conn *signald.Signald) (response AllIdentityKe
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -323,15 +313,14 @@ func (r *GetGroupRequest) Submit(conn *signald.Signald) (response JsonGroupV2Inf
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -356,15 +345,14 @@ func (r *GetIdentitiesRequest) Submit(conn *signald.Signald) (response IdentityK
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -389,15 +377,14 @@ func (r *GetLinkedDevicesRequest) Submit(conn *signald.Signald) (response Linked
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -422,15 +409,14 @@ func (r *GetProfileRequest) Submit(conn *signald.Signald) (response Profile, err
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -455,15 +441,14 @@ func (r *RemoteConfigRequest) Submit(conn *signald.Signald) (response RemoteConf
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -487,15 +472,14 @@ func (r *GetServersRequest) Submit(conn *signald.Signald) (response ServerList,
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -520,15 +504,14 @@ func (r *GroupLinkInfoRequest) Submit(conn *signald.Signald) (response JsonGroup
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -553,15 +536,14 @@ func (r *IsIdentifierRegisteredRequest) Submit(conn *signald.Signald) (response
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -586,15 +568,14 @@ func (r *JoinGroupRequest) Submit(conn *signald.Signald) (response JsonGroupJoin
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -618,15 +599,14 @@ func (r *LeaveGroupRequest) Submit(conn *signald.Signald) (response GroupInfo, e
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -651,15 +631,14 @@ func (r *ListAccountsRequest) Submit(conn *signald.Signald) (response AccountLis
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -683,15 +662,14 @@ func (r *ListContactsRequest) Submit(conn *signald.Signald) (response ProfileLis
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -715,15 +693,14 @@ func (r *ListGroupsRequest) Submit(conn *signald.Signald) (response GroupList, e
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -747,15 +724,14 @@ func (r *MarkReadRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -773,15 +749,14 @@ func (r *ReactRequest) Submit(conn *signald.Signald) (response SendResponse, err
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -806,15 +781,14 @@ func (r *RefuseMembershipRequest) Submit(conn *signald.Signald) (response JsonGr
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -839,15 +813,14 @@ func (r *RegisterRequest) Submit(conn *signald.Signald) (response Account, err e
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -872,15 +845,14 @@ func (r *RemoteDeleteRequest) Submit(conn *signald.Signald) (response SendRespon
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -905,15 +877,14 @@ func (r *RemoveLinkedDeviceRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -931,15 +902,14 @@ func (r *RequestSyncRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -957,15 +927,14 @@ func (r *ResetSessionRequest) Submit(conn *signald.Signald) (response SendRespon
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -990,15 +959,14 @@ func (r *ResolveAddressRequest) Submit(conn *signald.Signald) (response JsonAddr
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1022,15 +990,14 @@ func (r *SendRequest) Submit(conn *signald.Signald) (response SendResponse, err
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1055,15 +1022,14 @@ func (r *SendPaymentRequest) Submit(conn *signald.Signald) (response SendRespons
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1088,15 +1054,14 @@ func (r *SetDeviceNameRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1114,15 +1079,14 @@ func (r *SetExpirationRequest) Submit(conn *signald.Signald) (response SendRespo
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1146,15 +1110,14 @@ func (r *SetProfile) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1171,15 +1134,14 @@ func (r *SubmitChallengeRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1197,15 +1159,14 @@ func (r *SubscribeRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1223,15 +1184,14 @@ func (r *TrustRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1249,15 +1209,14 @@ func (r *TypingRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1275,15 +1234,14 @@ func (r *UnsubscribeRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1301,15 +1259,14 @@ func (r *UpdateContactRequest) Submit(conn *signald.Signald) (response Profile,
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1334,15 +1291,14 @@ func (r *UpdateGroupRequest) Submit(conn *signald.Signald) (response GroupInfo,
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1367,15 +1323,14 @@ func (r *VerifyRequest) Submit(conn *signald.Signald) (response Account, err err
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1399,15 +1354,14 @@ func (r *VersionRequest) Submit(conn *signald.Signald) (response JsonVersionMess
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
@ -1432,15 +1386,14 @@ func (r *WaitForScanRequest) Submit(conn *signald.Signald) (err error) {
|
|||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
|
|
@ -22,15 +22,14 @@ func {{$action.FnName}}(conn *signald.Signald) ({{if ne $action.Response ""}}res
|
|||
if(r.ID == "") {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
|
||||
rawResponse := <- responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
|
|
Loading…
Reference in a new issue