Skip to content

Commit 74ff68c

Browse files
committed
comments cleanup
1 parent 85f4a14 commit 74ff68c

File tree

4 files changed

+3
-45
lines changed

4 files changed

+3
-45
lines changed

MastodonMgr.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,6 @@ func (mMgr *MastodonMgr) cleanupMastodonMidMap(w io.Writer) {
13111311
skv.DbMutex.Unlock()
13121312

13131313
if err!=nil {
1314-
// this is bad
13151314
fmt.Printf("# cleanupMastodonMidMap delete=%d err=%v\n", len(deleteMidArray), err)
13161315
} else if len(deleteMidArray)>0 {
13171316
fmt.Printf("cleanupMastodonMidMap delete=%d (no err)\n", len(deleteMidArray))
@@ -1324,7 +1323,6 @@ func (mMgr *MastodonMgr) cleanupMastodonMidMap(w io.Writer) {
13241323
fmt.Printf("cleanupMastodonMidMap kv.Delete(dbMid,%s)\n",mid)
13251324
err = kv.Delete(dbMid, mid)
13261325
if err!=nil {
1327-
// this is bad
13281326
fmt.Printf("# cleanupMastodonMidMap delete dbMid mid=%s err=%v\n", mid, err)
13291327
}
13301328
} else {

skv/skv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// skv uses BoltDB for storage and the encoding/gob package for encoding and
1414
// decoding values. There are no other dependencies.
1515
//
16-
// tmtmtm: switched to go.etcd.io/bbolt
16+
// tm: switched to go.etcd.io/bbolt
1717
package skv
1818

1919
import (

timer.go

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ func ticker3hours() {
104104
if deleteKey {
105105
err2 = c.Delete()
106106
if err2!=nil {
107-
// this is bad
108107
fmt.Printf("# ticker3hours %d id=%s error read delete err=%v\n", counter, k, err2)
109108
} else {
110109
counterDeleted++
@@ -121,7 +120,6 @@ func ticker3hours() {
121120
})
122121
skv.DbMutex.Unlock()
123122
if err!=nil {
124-
// this is bad
125123
fmt.Printf("# ticker3hours delete=%d offline for %d days err=%v\n", counterDeleted,maxDaysOffline,err)
126124
} else /*if counterDeleted>0*/ {
127125
if logWantedFor("timer") {
@@ -160,7 +158,6 @@ func ticker3hours() {
160158
/* already done by c.Delete()
161159
err = kv.Delete(dbRegisteredIDs, userID)
162160
if err!=nil {
163-
// this is bad
164161
fmt.Printf("# ticker3hours delete dbRegisteredIDs id=%s err=%v\n", userID, err)
165162
}
166163
*/
@@ -173,7 +170,6 @@ func ticker3hours() {
173170
dbUserKey := fmt.Sprintf("%s_%d",userID, timeNowUnix)
174171
err = kvMain.Put(dbBlockedIDs, dbUserKey, DbUser{}, false)
175172
if err!=nil {
176-
// this is bad
177173
fmt.Printf("# ticker3hours error db=%s bucket=%s put key=%s err=%v\n",
178174
dbMainName,dbBlockedIDs,dbUserKey,err)
179175
}
@@ -195,8 +191,6 @@ func ticker3hours() {
195191
if err!=nil {
196192
//fmt.Printf("# ticker3hours delete dbHashedPwBucket user-id=%s err=%v\n", userID, err)
197193
// can be ignored for now (see above)
198-
} else {
199-
// all is well
200194
}
201195
}
202196

@@ -255,7 +249,6 @@ func ticker3hours() {
255249
})
256250
skv.DbMutex.Unlock()
257251
if err!=nil {
258-
// this is bad
259252
fmt.Printf("# ticker3hours delete=%d blocked for %d days err=%v\n",counterDeleted2,blockedForDays,err)
260253
} else /*if counterDeleted2>0*/ {
261254
if logWantedFor("timer") {
@@ -269,11 +262,7 @@ func ticker3hours() {
269262
}
270263
err = kv.Delete(dbBlockedIDs, key)
271264
if err!=nil {
272-
// this is bad
273265
fmt.Printf("# ticker3hours delete blocked user-id=%s err=%v\n", key, err)
274-
} else {
275-
// all is well
276-
//fmt.Printf("ticker3hours key=%s user deleted\n", key)
277266
}
278267
}
279268

@@ -354,7 +343,6 @@ func dbHashedPwLoop(w http.ResponseWriter) {
354343
skv.DbMutex.Unlock()
355344

356345
if err!=nil {
357-
// this is bad
358346
fmt.Printf("# dbHashedPwLoop done err=%v\n", err)
359347
if w!=nil {
360348
fmt.Fprintf(w,"# dbHashedPwLoop done err=%v\n", err)
@@ -374,7 +362,6 @@ func dbHashedPwLoop(w http.ResponseWriter) {
374362
for _,key := range deleteKeyArray {
375363
err = kv.Delete(dbHashedPwBucket, key)
376364
if err!=nil {
377-
// this is bad
378365
fmt.Printf("# ticker3hours delete user-id=%s err=%v\n", key, err)
379366
} else {
380367
deleteCount++
@@ -426,12 +413,10 @@ func dbHashedPwSearch(name string) (PwIdCombo,error) {
426413
})
427414
skv.DbMutex.Unlock()
428415

429-
// TODO (in principle):
430416
// if pwIdComboNewest.CalleeId!="" and if we have found more than 1 entry
431417
// then all the older entries (all entries other than pwIdComboNewest) can be deleted
432418

433419
if err!=nil {
434-
// this is bad
435420
fmt.Printf("# dbHashedPwSearch done userID=(%s) err=%v\n", pwIdComboNewest.CalleeId, err)
436421
return pwIdComboNewest,err
437422
}
@@ -469,7 +454,6 @@ func ticker20min() {
469454
cleanupClientRequestsMap(os.Stdout, 10, "ticker20min")
470455

471456
if mastodonMgr != nil {
472-
// TODO do both need to be called more often than 1x per 30min - maybe not
473457
mastodonMgr.cleanupMastodonMidMap(os.Stdout)
474458
mastodonMgr.cleanupPostedMsgEvents(os.Stdout)
475459
}
@@ -484,7 +468,6 @@ func cleanupCalleeLoginMap(w io.Writer, min int, title string) {
484468
calleeLoginMutex.Lock()
485469
defer calleeLoginMutex.Unlock()
486470
for calleeID,calleeLoginSlice := range calleeLoginMap {
487-
//fmt.Fprintf(w,"%s calleeLoginMap (%s) A len=%d\n", title, calleeID, len(calleeLoginSlice))
488471
for len(calleeLoginSlice)>0 {
489472
if time.Now().Sub(calleeLoginSlice[0]) < 30 * time.Minute {
490473
break
@@ -706,20 +689,15 @@ func ticker3min() {
706689
}
707690
}
708691

709-
// tmtmtm cleanup missedCallAllowedMap
710-
var deleteIpArray []string // for deleting
692+
// cleanup missedCallAllowedMap
693+
var deleteIpArray []string
711694
missedCallAllowedMutex.Lock()
712695
for ip,settime := range missedCallAllowedMap {
713696
if time.Now().Sub(settime) > 20*time.Minute {
714697
deleteIpArray = append(deleteIpArray, ip)
715698
}
716699
}
717700
for _,ip := range deleteIpArray {
718-
// if logWantedFor("timer") {
719-
// if logWantedFor("missedcall") {
720-
// fmt.Printf("ticker3min delete (%s) from missedCallAllowedMap\n",ip)
721-
// }
722-
// }
723701
delete(missedCallAllowedMap,ip)
724702
}
725703
missedCallAllowedMutex.Unlock()

wsClient.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -540,24 +540,6 @@ func serve(w http.ResponseWriter, r *http.Request, tls bool) {
540540
hub.lastCallerContactTime = time.Now().Unix()
541541
hub.HubMutex.Unlock()
542542

543-
/* tmtmtm
544-
// TODO when callee is making a call, it will NOT be in busy state for other callers
545-
if callerID!="" {
546-
// so lets set hub.ConnectedCallerIp? doesn't work
547-
tmpRemoteIP := "aaa"
548-
err := StoreCallerIpInHubMap(calleeID, tmpRemoteIP, false)
549-
if err!=nil {
550-
fmt.Printf("# %s (%s) StoreCallerIp %s (%s) err=%v\n",
551-
client.connType, calleeID, tmpRemoteIP, callerID, err)
552-
} else {
553-
if logWantedFor("wscall") {
554-
fmt.Printf("%s (%s) callerOffer StoreCallerIp %s\n",
555-
client.connType, callerID, tmpRemoteIP)
556-
}
557-
}
558-
}
559-
*/
560-
561543
// connection watchdog now has two timeouts
562544
// 1. from when caller connects (now) to when callee sends calleeAnswer (max 60s)
563545
// 2. from when callee sends calleeAnswer to when p2p-connect should occur (max 14s)

0 commit comments

Comments
 (0)