minor comments

This commit is contained in:
2026-09-12 23:01:21 -04:00
parent 5f7ce723ae
commit 5b0ef3e596
+8 -17
View File
@@ -1,7 +1,7 @@
// ============================================================================= // =============================================================================
// Auth: alex // Auth: alex
// File: server.go // File: server.go
// Revn: 09-06-2026 3.0.0 // Revn: 09-12-2026 3.0.1
// Func: host MOTD connection // Func: host MOTD connection
// //
// TODO: add user-specific prints // TODO: add user-specific prints
@@ -52,6 +52,7 @@
// 05-12-2026: added v and vv input flags // 05-12-2026: added v and vv input flags
// 09-05-2026: buncha shit happened, dropped the commit // 09-05-2026: buncha shit happened, dropped the commit
//#09-06-2026: added /e1/, /e2/, and /cr/, got edit working //#09-06-2026: added /e1/, /e2/, and /cr/, got edit working
// 09-12-2026: minor comments in receive()
// //
// ============================================================================= // =============================================================================
@@ -151,27 +152,18 @@ func receive( conn net.Conn ) {
n, err := conn.Read( buffer[:] ) n, err := conn.Read( buffer[:] )
checkN( err, conn ) // make sure read worked checkN( err, conn ) // make sure read worked
// message anatomy
// command@number[@user]
// @ @ delimiter
// command command, like list request or quote request
// number sequence or quote number
// user quote username if applicable, default if not give
// add request message anatomy
// command@quote[@user]
// quote quote to be added
// user quote username, default if not given
// cast message to string, take first n bytes, split over @ // cast message to string, take first n bytes, split over @
command := strings.Split( string( buffer[:n] ), "@" ) command := strings.Split( string( buffer[:n] ), "@" )
// if command is to end transaction
if command[0] == "te" { if command[0] == "te" {
conn.Close() conn.Close() // end transaction
return return // and bail
} }
// process command get response
resp := handle( command ) resp := handle( command )
// write response to client // write response to client
_, err = conn.Write( []byte( resp ) ) _, err = conn.Write( []byte( resp ) )
checkN( err, conn ) // make sure write worked checkN( err, conn ) // make sure write worked
@@ -438,7 +430,6 @@ func handle( command []string ) string {
// globals // globals
var qlist []string // list of quotes var qlist []string // list of quotes
//var qlist = make( map[string][]string )
var qfile string // file object var qfile string // file object
var tsize int // size of transmission buffer var tsize int // size of transmission buffer
var VERS string // version var VERS string // version
@@ -462,7 +453,7 @@ func main() {
flag.Parse() flag.Parse()
// FIXME get better versioning method // FIXME get better versioning method
VERS = "3.0.0" VERS = "3.0.1"
if vv { // display info and exit if vv { // display info and exit
fmt.Println( "ekho server v" + VERS ) fmt.Println( "ekho server v" + VERS )