sendCallbackID send the callback number to be deleted after response is received.
(callbacks map[string]dnode.Path, ch chan<- uint64)
| 920 | |
| 921 | // sendCallbackID send the callback number to be deleted after response is received. |
| 922 | func sendCallbackID(callbacks map[string]dnode.Path, ch chan<- uint64) { |
| 923 | // TODO fix finding of responseCallback in dnode message when removing callback |
| 924 | for id, path := range callbacks { |
| 925 | if len(path) != 2 { |
| 926 | continue |
| 927 | } |
| 928 | p0, ok := path[0].(string) |
| 929 | if !ok { |
| 930 | continue |
| 931 | } |
| 932 | p1, ok := path[1].(string) |
| 933 | if !ok { |
| 934 | continue |
| 935 | } |
| 936 | if p0 != "0" || p1 != "responseCallback" { |
| 937 | continue |
| 938 | } |
| 939 | i, _ := strconv.ParseUint(id, 10, 64) |
| 940 | ch <- i |
| 941 | return |
| 942 | } |
| 943 | close(ch) |
| 944 | } |
| 945 | |
| 946 | // makeResponseCallback prepares and returns a callback function sent to the server. |
| 947 | // The caller of the Tell() is blocked until the server calls this callback function. |