diff --git a/server/api_key.go b/server/api_key.go index 8f85a3ca..423f64cb 100644 --- a/server/api_key.go +++ b/server/api_key.go @@ -18,7 +18,9 @@ import ( ) // Singned AppID. Composition: -// [1:algorithm version][4:appid][2:key sequence][1:isRoot][16:signature] = 24 bytes +// +// [1:algorithm version][4:appid][2:key sequence][1:isRoot][16:signature] = 24 bytes +// // convertible to base64 without padding. All integers are little-endian. // Definitions for byte lengths of key's parts. const ( @@ -37,7 +39,9 @@ const ( ) // Client signature validation -// key: client's secret key +// +// key: client's secret key +// // Returns application id, key type. func checkAPIKey(apikey string) (isValid, isRoot bool) { if declen := base64.URLEncoding.DecodedLen(len(apikey)); declen != apikeyLength { diff --git a/server/hdl_longpoll.go b/server/hdl_longpoll.go index 960b912a..5a061f63 100644 --- a/server/hdl_longpoll.go +++ b/server/hdl_longpoll.go @@ -116,11 +116,11 @@ func (sess *Session) readOnce(wrt http.ResponseWriter, req *http.Request) (int, // serveLongPoll handles long poll connections when WebSocket is not available // Connection could be without sid or with sid: -// - if sid is empty, create session, expect a login in the same request, respond and close -// - if sid is not empty and there is an initialized session, payload is optional +// - if sid is empty, create session, expect a login in the same request, respond and close +// - if sid is not empty and there is an initialized session, payload is optional // - if no payload, perform long poll // - if payload exists, process it and close -// - if sid is not empty but there is no session, report an error +// - if sid is not empty but there is no session, report an error func serveLongPoll(wrt http.ResponseWriter, req *http.Request) { now := time.Now().UTC().Round(time.Millisecond) diff --git a/server/pres.go b/server/pres.go index e581613a..2d2eba18 100644 --- a/server/pres.go +++ b/server/pres.go @@ -80,13 +80,14 @@ func (t *Topic) loadContacts(uid types.Uid) error { // This topic got a request from a 'me' topic to start/stop sending presence updates. // The originating topic reports its own status in 'what' as "on", "off", "gone" or "?unkn". -// "on" - requester came online -// "off" - requester is offline now -// "?none" - anchor for "+" command: requester status is unknown, won't generate a response -// and isn't forwarded to clients. -// "gone" - topic deleted or otherwise gone - equivalent of "off+remove" -// "?unkn" - requester wants to initiate online status exchange but it's own status is unknown yet. This -// notifications is not forwarded to users. +// +// "on" - requester came online +// "off" - requester is offline now +// "?none" - anchor for "+" command: requester status is unknown, won't generate a response +// and isn't forwarded to clients. +// "gone" - topic deleted or otherwise gone - equivalent of "off+remove" +// "?unkn" - requester wants to initiate online status exchange but it's own status is unknown yet. This +// notifications is not forwarded to users. // // "+" commands: // "+en": enable subscription, i.e. start accepting incoming notifications from the user2; diff --git a/server/session.go b/server/session.go index 4a7a1be2..b4ca761f 100644 --- a/server/session.go +++ b/server/session.go @@ -1267,9 +1267,10 @@ func (s *Session) note(msg *ClientComMessage) { // expandTopicName expands session specific topic name to global name // Returns -// topic: session-specific topic name the message recipient should see -// routeTo: routable global topic name -// err: *ServerComMessage with an error to return to the sender +// +// topic: session-specific topic name the message recipient should see +// routeTo: routable global topic name +// err: *ServerComMessage with an error to return to the sender func (s *Session) expandTopicName(msg *ClientComMessage) (string, *ServerComMessage) { if msg.Original == "" { logs.Warn.Println("s.etn: empty topic name", s.sid) diff --git a/server/sessionstore.go b/server/sessionstore.go index 85766786..aee23a14 100644 --- a/server/sessionstore.go +++ b/server/sessionstore.go @@ -203,8 +203,8 @@ func (ss *SessionStore) EvictUser(uid types.Uid, skipSid string) { } // NodeRestarted removes stale sessions from a restarted cluster node. -// - nodeName is the name of affected node -// - fingerprint is the new fingerprint of the node. +// - nodeName is the name of affected node +// - fingerprint is the new fingerprint of the node. func (ss *SessionStore) NodeRestarted(nodeName string, fingerprint int64) { ss.lock.Lock() defer ss.lock.Unlock() diff --git a/server/stats.go b/server/stats.go index ff9a631e..222e5872 100644 --- a/server/stats.go +++ b/server/stats.go @@ -19,9 +19,10 @@ import ( // A simple implementation of histogram expvar.Var. // `Bounds` specifies the histogram buckets as follows (length = len(bounds)): -// (-inf, Bounds[i]) for i = 0 -// [Bounds[i-1], Bounds[i]) for 0 < i < length -// [Bounds[i-1], +inf) for i = length +// +// (-inf, Bounds[i]) for i = 0 +// [Bounds[i-1], Bounds[i]) for 0 < i < length +// [Bounds[i-1], +inf) for i = length type histogram struct { Count int64 `json:"count"` Sum float64 `json:"sum"` diff --git a/server/store/store.go b/server/store/store.go index 7f74355d..481b202c 100644 --- a/server/store/store.go +++ b/server/store/store.go @@ -113,7 +113,7 @@ type storeObj struct{} // Open initializes the persistence system. Adapter holds a connection pool for a database instance. // -// name - name of the adapter rquested in the config file +// name - name of the adapter rquested in the config file // jsonconf - configuration string func (storeObj) Open(workerId int, jsonconf json.RawMessage) error { if err := openAdapter(workerId, jsonconf); err != nil { diff --git a/server/utils.go b/server/utils.go index df001081..9b8fb801 100644 --- a/server/utils.go +++ b/server/utils.go @@ -104,9 +104,10 @@ func normalizeTags(src []string) types.StringSlice { } // stringDelta extracts the slices of added and removed strings from two slices: -// added := newSlice - (oldSlice & newSlice) -- present in new but missing in old -// removed := oldSlice - (oldSlice & newSlice) -- present in old but missing in new -// intersection := oldSlice & newSlice -- present in both old and new +// +// added := newSlice - (oldSlice & newSlice) -- present in new but missing in old +// removed := oldSlice - (oldSlice & newSlice) -- present in old but missing in new +// intersection := oldSlice & newSlice -- present in both old and new func stringSliceDelta(rold, rnew []string) (added, removed, intersection []string) { if len(rold) == 0 && len(rnew) == 0 { return nil, nil, nil