func (c *TF2RconConnection) Reconnect(duration time.Duration) error {
	if atomic.LoadInt32(c.reconnecting) == 1 {
		c.rcLock.RLock()
		c.rcLock.RUnlock()
		return nil
	}

	c.rcLock.Lock()
	defer c.rcLock.Unlock()

	atomic.StoreInt32(c.reconnecting, 1)
	defer atomic.StoreInt32(c.reconnecting, 0)

	if c.rc != nil {
		c.rc.Close()
	}

	now := time.Now()
	var err error

	for time.Since(now) <= duration {
		c.rc, err = rcon.Dial(c.host, c.password)
		if err == nil {
			return nil
		}
	}

	return err
}
// NewTF2RconConnection builds a new TF2RconConnection to a server at address ("ip:port") using
// a rcon_password password
func NewTF2RconConnection(address, password string) (*TF2RconConnection, error) {
	rc, err := rcon.Dial(address, password)
	if err != nil {
		return nil, err
	}

	return &TF2RconConnection{
		rc:           rc,
		host:         address,
		password:     password,
		reconnecting: new(int32),
	}, nil
}