Changeset 652 in code for trunk/downstream.go


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

Add context args to Database interface

This is a mecanical change, which just lifts up the context.TODO()
calls from inside the DB implementations to the callers.

Future work involves properly wiring up the contexts when it makes
sense.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r651 r652  
    22
    33import (
     4        "context"
    45        "crypto/tls"
    56        "encoding/base64"
     
    977978        username, clientName, networkName := unmarshalUsername(username)
    978979
    979         u, err := dc.srv.db.GetUser(username)
     980        u, err := dc.srv.db.GetUser(context.TODO(), username)
    980981        if err != nil {
    981982                dc.logger.Printf("failed authentication for %q: user not found: %v", username, err)
     
    13781379                        }
    13791380                        n.Nick = nick
    1380                         err = dc.srv.db.StoreNetwork(dc.user.ID, &n.Network)
     1381                        err = dc.srv.db.StoreNetwork(context.TODO(), dc.user.ID, &n.Network)
    13811382                })
    13821383                if err != nil {
     
    14281429
    14291430                                n.Realname = storeRealname
    1430                                 if err := dc.srv.db.StoreNetwork(dc.user.ID, &n.Network); err != nil {
     1431                                if err := dc.srv.db.StoreNetwork(context.TODO(), dc.user.ID, &n.Network); err != nil {
    14311432                                        dc.logger.Printf("failed to store network realname: %v", err)
    14321433                                        storeErr = err
     
    15171518                                uc.network.channels.SetValue(upstreamName, ch)
    15181519                        }
    1519                         if err := dc.srv.db.StoreChannel(uc.network.ID, ch); err != nil {
     1520                        if err := dc.srv.db.StoreChannel(context.TODO(), uc.network.ID, ch); err != nil {
    15201521                                dc.logger.Printf("failed to create or update channel %q: %v", upstreamName, err)
    15211522                        }
     
    15491550                                        uc.network.channels.SetValue(upstreamName, ch)
    15501551                                }
    1551                                 if err := dc.srv.db.StoreChannel(uc.network.ID, ch); err != nil {
     1552                                if err := dc.srv.db.StoreChannel(context.TODO(), uc.network.ID, ch); err != nil {
    15521553                                        dc.logger.Printf("failed to create or update channel %q: %v", upstreamName, err)
    15531554                                }
     
    24462447        n.SASL.Plain.Username = username
    24472448        n.SASL.Plain.Password = password
    2448         if err := dc.srv.db.StoreNetwork(dc.user.ID, &n.Network); err != nil {
     2449        if err := dc.srv.db.StoreNetwork(context.TODO(), dc.user.ID, &n.Network); err != nil {
    24492450                dc.logger.Printf("failed to save NickServ credentials: %v", err)
    24502451        }
Note: See TracChangeset for help on using the changeset viewer.