Changeset 605 in code for trunk/service.go


Ignore:
Timestamp:
Oct 5, 2021, 5:13:53 PM (4 years ago)
Author:
contact
Message:

Add "server status" command

Right now, it prints the number of active users and number of
downstream connections.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/service.go

    r577 r605  
    293293                        },
    294294                },
     295                "server": {
     296                        children: serviceCommandSet{
     297                                "status": {
     298                                        desc:   "show server statistics",
     299                                        handle: handleServiceServerStatus,
     300                                        admin:  true,
     301                                },
     302                        },
     303                        admin: true,
     304                },
    295305        }
    296306}
     
    10081018        return nil
    10091019}
     1020
     1021func handleServiceServerStatus(dc *downstreamConn, params []string) error {
     1022        stats := dc.user.srv.Stats()
     1023        sendServicePRIVMSG(dc, fmt.Sprintf("%v users, %v downstreams", stats.Users, stats.Downstreams))
     1024        return nil
     1025}
Note: See TracChangeset for help on using the changeset viewer.