diff options
Diffstat (limited to 'internal/server')
| -rw-r--r-- | internal/server/api/api.go | 6 | ||||
| -rw-r--r-- | internal/server/server.go | 13 |
2 files changed, 7 insertions, 12 deletions
diff --git a/internal/server/api/api.go b/internal/server/api/api.go index 2a0452a..9828af6 100644 --- a/internal/server/api/api.go +++ b/internal/server/api/api.go @@ -589,7 +589,7 @@ func DeleteNetwork(ctx context.Context, sess *session.Session, request *packet.D return &ErrInternalError } - // NOTE: important check, make sure they are the owner (authorized) + // NOTE(kyren): important check, make sure they are the owner (authorized) if network.OwnerID != sess.ID() { return &ErrPermissionDenied } @@ -1148,7 +1148,7 @@ func EditMessage(ctx context.Context, sess *session.Session, request *packet.Edi return &ErrInternalError } - // Note: it is possible to edit your messages in any context + // NOTE(kyren): it is possible to edit your messages in any context // regardless if you are in the network or if you have access to // the frequency (or a user signal), as long as you know the message ID // This should be fine but may be changed later to be more strict @@ -1640,7 +1640,7 @@ func Authenticate(ctx context.Context, sess *session.Session, request *packet.Au sess.Manager().AddSession(sess, user.ID, request.PubKey) - // NOTE: as per the protocol, this must be the first message after auth + // NOTE(kyren): as per the protocol, this must be the first message after auth payload := &packet.UsersInfo{Users: []data.User{user}} ok := sess.Write(ctx, payload) if !ok { diff --git a/internal/server/server.go b/internal/server/server.go index 9794038..bdfba15 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -362,7 +362,7 @@ func (server *server) handleConnection(conn net.Conn) { slog.InfoContext(ctx, "processor done") }() - // NOTE: IMPROTANT LEGAL STUFF + // NOTE(kyren): IMPROTANT LEGAL STUFF // Sending this first thing, before client sends us any data sendTosInfo(ctx, sess) @@ -552,15 +552,10 @@ func timeout[T packet.Payload]( apiRequest func(context.Context, *session.Session, T) packet.Payload, ctx context.Context, sess *session.Session, request T, ) packet.Payload { - // TODO(kyren): Remove the channel and just wait directly? - // No - We need to use a channel so timeout works properly + // NOTE(kyren): We need to use a channel so timeout works properly responseChan := make(chan packet.Payload) - // TODO: Check if this is now fixed after the rewrite: - // currently just ignoring the given context - // this fixes the issue where the client disconnects so the server - // doesn't bother and cancels the request - ctx, cancel := context.WithTimeout(ctx, timeoutDuration) // no longer ignoring + ctx, cancel := context.WithTimeout(ctx, timeoutDuration) defer cancel() go func() { @@ -607,7 +602,7 @@ func TokensPerRequest(requestType packet.PacketType) float64 { case packet.PacketDeviceAnalytics: return 0.2 // arbitrary - // TODO: once I get more data for these, add them + // TODO(kyren): once I get more data for these, add them case packet.PacketBlockUser: case packet.PacketCreateFrequency: case packet.PacketCreateNetwork: |
