Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 40 for SafeClose (0.29 sec)

  1. internal/grid/muxserver.go

    }
    
    func (m *muxServer) close() {
    	m.cancel()
    	m.recvMu.Lock()
    	defer m.recvMu.Unlock()
    
    	if m.inbound != nil {
    		xioutil.SafeClose(m.inbound)
    		m.inbound = nil
    	}
    
    	if m.outBlock != nil {
    		xioutil.SafeClose(m.outBlock)
    		m.outBlock = nil
    
    	}
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  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. internal/store/store.go

    // replayItems - Reads the items from the store and replays.
    func replayItems[I any](store Store[I], doneCh <-chan struct{}, log logger, id string) <-chan Key {
    	keyCh := make(chan Key)
    
    	go func() {
    		defer xioutil.SafeClose(keyCh)
    
    		retryTicker := time.NewTicker(retryInterval)
    		defer retryTicker.Stop()
    
    		for {
    			names, err := store.List()
    			if err != nil {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Mon Mar 25 16:44:20 GMT 2024
    - 3.5K bytes
    - Viewed (0)
  8. cmd/erasure-server-pool.go

    			disks, infos, _ := set.getOnlineDisksWithHealingAndInfo(true)
    			if len(disks) == 0 {
    				xioutil.SafeClose(results)
    				cancel()
    				return fmt.Errorf("Walk: no online disks found in pool %d, set %d", setIdx, poolIdx)
    			}
    			go func() {
    				defer xioutil.SafeClose(listOut)
    				send := func(e metaCacheEntry) {
    					if e.isDir() {
    						// Ignore directories.
    						return
    					}
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri May 03 20:08:20 GMT 2024
    - 80.5K bytes
    - Viewed (0)
  9. 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)
  10. cmd/service.go

    		// Set to a nil channel.
    		var _ch chan struct{}
    		if val := globalServiceFreeze.Swap(_ch); val != nil {
    			if ch, ok := val.(chan struct{}); ok && ch != nil {
    				// Close previous non-nil channel.
    				xioutil.SafeClose(ch)
    			}
    		}
    		globalServiceFreezeCnt = 0 // Don't risk going negative.
    	}
    	globalServiceFreezeMu.Unlock()
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Wed Feb 28 07:02:14 GMT 2024
    - 3.8K bytes
    - Viewed (0)
Back to top