Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 29 for SafeClose (0.2 sec)

  1. internal/grid/muxclient.go

    	defer m.respMu.Unlock()
    	if !m.closed {
    		m.respErr.Store(&err)
    		// Do not block.
    		select {
    		case respHandler <- Response{Err: err}:
    			xioutil.SafeClose(respHandler)
    		default:
    			go func() {
    				respHandler <- Response{Err: err}
    				xioutil.SafeClose(respHandler)
    			}()
    		}
    		gridLogIf(m.ctx, m.sendLocked(message{Op: OpDisconnectServerMux, MuxID: m.MuxID}))
    		m.closed = true
    	}
    }
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 14.2K bytes
    - Viewed (0)
  2. cmd/metacache-server-pool.go

    				returned = funcReturned
    				funcReturnedMu.Unlock()
    				outCh <- entry
    				if returned {
    					xioutil.SafeClose(outCh)
    				}
    			}
    			entry.reusable = returned
    			saveCh <- entry
    		}
    		if !returned {
    			xioutil.SafeClose(outCh)
    		}
    		xioutil.SafeClose(saveCh)
    	}()
    
    	return filteredResults()
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 12.8K bytes
    - Viewed (0)
  3. internal/grid/handlers.go

    		}
    		go func() {
    			defer xioutil.SafeClose(stream.Requests)
    			for req := range reqT {
    				b, err := req.MarshalMsg(GetByteBufferCap(req.Msgsize()))
    				if err != nil {
    					gridLogOnceIf(ctx, err, err.Error())
    				}
    				h.PutRequest(req)
    				stream.Requests <- b
    			}
    		}()
    	} else if stream.Requests != nil {
    		xioutil.SafeClose(stream.Requests)
    	}
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Tue Apr 23 17:15:52 GMT 2024
    - 27.1K bytes
    - Viewed (0)
  4. cmd/storage-rest-server.go

    func (c *closeNotifier) Read(p []byte) (n int, err error) {
    	n, err = c.rc.Read(p)
    	if err != nil {
    		if c.done != nil {
    			xioutil.SafeClose(c.done)
    			c.done = nil
    		}
    	}
    	return n, err
    }
    
    func (c *closeNotifier) Close() error {
    	if c.done != nil {
    		xioutil.SafeClose(c.done)
    		c.done = nil
    	}
    	return c.rc.Close()
    }
    
    // keepHTTPReqResponseAlive can be used to avoid timeouts with long storage
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Sun Apr 28 17:53:50 GMT 2024
    - 44.8K bytes
    - Viewed (0)
  5. cmd/perf-tests.go

    					if err != nil {
    						errStr = fmt.Sprintf("error with %s: %s", globalNotificationSys.peerClients[index].String(), err.Error())
    					}
    				}()
    			}
    		}(index)
    	}
    
    	time.Sleep(duration)
    	xioutil.SafeClose(r.eof)
    	wg.Wait()
    	for {
    		if globalNetPerfRX.ActiveConnections() == 0 {
    			break
    		}
    		time.Sleep(time.Second)
    	}
    	rx := float64(globalNetPerfRX.RXSample)
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Sun Jan 28 18:04:17 GMT 2024
    - 11.3K bytes
    - Viewed (0)
  6. internal/ioutil/ioutil.go

    			// that we promised that we would write.
    			if totalSize > 0 && written != totalSize {
    				return written, io.ErrUnexpectedEOF
    			}
    			return written, nil
    		}
    	}
    }
    
    // SafeClose safely closes any channel of any type
    func SafeClose[T any](c chan<- T) {
    	if c != nil {
    		close(c)
    		return
    	}
    	// Print stack to check who is sending `c` as `nil`
    	// without crashing the server.
    	debug.PrintStack()
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Apr 19 11:26:59 GMT 2024
    - 10.3K bytes
    - Viewed (0)
  7. cmd/xl-storage-disk-id-check.go

    	if contextCanceled(ctx) {
    		xioutil.SafeClose(updates)
    		return dataUsageCache{}, ctx.Err()
    	}
    
    	if err := p.checkDiskStale(); err != nil {
    		xioutil.SafeClose(updates)
    		return dataUsageCache{}, err
    	}
    
    	weSleep := func() bool {
    		return scannerIdleMode.Load() == 0
    	}
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Sun Apr 28 17:53:50 GMT 2024
    - 33K bytes
    - Viewed (0)
  8. cmd/erasure.go

    		}
    	}
    	for _, idx := range permutes {
    		b := buckets[idx]
    		if e := oldCache.find(b.Name); e != nil {
    			cache.replace(b.Name, dataUsageRoot, *e)
    			bucketCh <- b
    		}
    	}
    	xioutil.SafeClose(bucketCh)
    
    	bucketResults := make(chan dataUsageEntryInfo, len(disks))
    
    	// Start async collector/saver.
    	// This goroutine owns the cache.
    	var saverWg sync.WaitGroup
    	saverWg.Add(1)
    	go func() {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Apr 26 06:32:14 GMT 2024
    - 16K bytes
    - Viewed (1)
  9. cmd/storage-rest-client.go

    	return nil
    }
    
    func (client *storageRESTClient) NSScanner(ctx context.Context, cache dataUsageCache, updates chan<- dataUsageEntry, scanMode madmin.HealScanMode, _ func() bool) (dataUsageCache, error) {
    	defer xioutil.SafeClose(updates)
    
    	st, err := storageNSScannerRPC.Call(ctx, client.gridConn, &nsScannerOptions{
    		DiskID:   *client.diskID.Load(),
    		ScanMode: int(scanMode),
    		Cache:    &cache,
    	})
    	if err != nil {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Sun Apr 28 17:53:50 GMT 2024
    - 26.1K bytes
    - Viewed (0)
  10. cmd/batch-expire.go

    			ObjectInfo: result,
    		})
    	}
    	// Send any remaining objects downstream
    	if len(toDel) > 0 {
    		select {
    		case <-ctx.Done():
    		case expireCh <- toDel:
    		}
    	}
    	xioutil.SafeClose(expireCh)
    
    	<-expireDoneCh // waits for the expire goroutine to complete
    	wk.Wait()      // waits for all expire workers to retire
    
    	ri.Complete = ri.ObjectsFailed == 0
    	ri.Failed = ri.ObjectsFailed > 0
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 21K bytes
    - Viewed (1)
Back to top