...
Run Format

Source file test/fixedbugs/issue19555.go

Documentation: test/fixedbugs

     1  // compile
     2  
     3  // Copyright 2017 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package p
     8  
     9  type NodeLink struct{}
    10  
    11  // A role our end of NodeLink is intended to play
    12  type LinkRole int64
    13  
    14  const (
    15  	LinkServer LinkRole = iota // link created as server
    16  	LinkClient                 // link created as client
    17  
    18  	// for testing:
    19  	linkNoRecvSend LinkRole = 1 << 16 // do not spawn serveRecv & serveSend
    20  	linkFlagsMask  LinkRole = (1<<32 - 1) << 16
    21  )
    22  
    23  func NewNodeLink(role LinkRole) *NodeLink {
    24  	var nextConnId uint32
    25  	switch role &^ linkFlagsMask {
    26  	case LinkServer:
    27  		nextConnId = 0 // all initiated by us connId will be even
    28  	case LinkClient:
    29  		nextConnId = 1 // ----//---- odd
    30  	default:
    31  		panic("invalid conn role")
    32  	}
    33  
    34  	_ = nextConnId
    35  	return nil
    36  }
    37  

View as plain text