Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 43 for SafeClose (0.21 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 Apr 21 19:28:08 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 Apr 21 19:28:08 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 Apr 21 19:28:08 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 Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 26.9K bytes
    - Viewed (0)
  5. 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 Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Apr 19 11:26:59 GMT 2024
    - 10.3K bytes
    - Viewed (0)
  6. 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 Apr 21 19:28:08 GMT 2024
    - Last Modified: Sun Jan 28 18:04:17 GMT 2024
    - 11.3K bytes
    - Viewed (0)
  7. 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 Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 11 17:45:28 GMT 2024
    - 44.3K bytes
    - Viewed (0)
  8. 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 Apr 21 19:28:08 GMT 2024
    - Last Modified: Mon Mar 25 16:44:20 GMT 2024
    - 3.5K bytes
    - Viewed (0)
  9. 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 Apr 21 19:28:08 GMT 2024
    - Last Modified: Mon Apr 15 10:02:39 GMT 2024
    - 16K bytes
    - Viewed (1)
  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 Apr 21 19:28:08 GMT 2024
    - Last Modified: Wed Feb 28 07:02:14 GMT 2024
    - 3.8K bytes
    - Viewed (0)
Back to top