summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-02-11 20:30:44 +0100
committerkali kaneko (leap communications) <kali@leap.se>2020-02-11 20:32:30 +0100
commit7bb4eb2e5444ef6b383b9c70a82a1c157074acd9 (patch)
tree91398621dc4675b9e22fcbb6824f90f7d6d36d96
parent3de1071816e4314cd6f8d465b95bbb57038c5a2d (diff)
[docs] comment on unsafe method
-rw-r--r--pkg/auth/sip2/client.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/auth/sip2/client.go b/pkg/auth/sip2/client.go
index d52fe2a..eca60c2 100644
--- a/pkg/auth/sip2/client.go
+++ b/pkg/auth/sip2/client.go
@@ -61,10 +61,10 @@ func newClient(host, port, location string) sipClient {
return c
}
+// starts a dispatcher goroutine that ensures that all sip requests are serialized
func (c *sipClient) startDispatcher() {
go func() {
- for {
- req := <-c.reqQueue
+ for req := range c.reqQueue {
resp, err := c.handleRequest(req.msg)
req.respChan <- response{resp, err}
}
@@ -102,6 +102,7 @@ func (c *sipClient) sendRequest(msg string) (string, error) {
return resp.msg, resp.err
}
+// handleRequest should not be used directly: dipatcher should be the only caller. use sendRequest instead.
func (c *sipClient) handleRequest(msg string) (string, error) {
err := telnetSend(c.conn, msg)
if err != nil {