Skip to content

Commit

Permalink
Separate some long lines
Browse files Browse the repository at this point in the history
  • Loading branch information
anacrolix committed Mar 21, 2024
1 parent 5ddf300 commit ebd2046
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion tracker/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ func (c *udpClient) Close() error {
return c.cl.Close()
}

func (c *udpClient) Announce(ctx context.Context, req AnnounceRequest, opts trHttp.AnnounceOpt) (res AnnounceResponse, err error) {
func (c *udpClient) Announce(
ctx context.Context,
req AnnounceRequest,
opts trHttp.AnnounceOpt,
) (res AnnounceResponse, err error) {
if req.IPAddress == 0 && opts.ClientIp4 != nil {
// I think we're taking bytes in big-endian order (all IPs), and writing it to a natively
// ordered uint32. This will be correctly ordered when written back out by the UDP client
Expand Down
13 changes: 11 additions & 2 deletions tracker/udp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ func (cl *Client) writeRequest(
return
}

func (cl *Client) requestWriter(ctx context.Context, action Action, body []byte, tId TransactionId) (err error) {
func (cl *Client) requestWriter(
ctx context.Context,
action Action,
body []byte,
tId TransactionId,
) (err error) {
var buf bytes.Buffer
for n := 0; ; n++ {
err = cl.writeRequest(ctx, action, body, tId, &buf)
Expand All @@ -192,7 +197,11 @@ func (me ErrorResponse) Error() string {
return fmt.Sprintf("error response: %#q", me.Message)
}

func (cl *Client) request(ctx context.Context, action Action, body []byte) (respBody []byte, addr net.Addr, err error) {
func (cl *Client) request(
ctx context.Context,
action Action,
body []byte,
) (respBody []byte, addr net.Addr, err error) {
respChan := make(chan DispatchedResponse, 1)
t := cl.Dispatcher.NewTransaction(func(dr DispatchedResponse) {
respChan <- dr
Expand Down

0 comments on commit ebd2046

Please sign in to comment.