MCPcopy Create free account

hub / github.com/panjf2000/gnet / functions

Functions759 in github.com/panjf2000/gnet

↓ 347 callersMethodRun
Run is about to be executed by the event-loop.
gnet.go:383
↓ 114 callersFunctiontestUnixAddr
testUnixAddr uses os.MkdirTemp to get a name that is unique. See https://github.com/golang/go/issues/62614.
gnet_test.go:52
↓ 112 callersFunctionrunServer
(t *testing.T, addrs []string, conf *testConf)
gnet_test.go:785
↓ 74 callersMethodClose
Close closes the current connection, implements net.Conn, it's concurrency-safe.
gnet.go:470
↓ 64 callersMethodBuffered
Buffered returns the length of available bytes to read.
pkg/buffer/ring/ring_buffer.go:270
↓ 60 callersMethodIsEmpty
()
pkg/queue/queue.go:46
↓ 60 callersFunctionrunClient
(t *testing.T, network, addr string, conf *testConf)
client_test.go:494
↓ 47 callersMethodAvailable
Available returns the length of available bytes to write.
pkg/buffer/ring/ring_buffer.go:296
↓ 46 callersMethodWrite
(p []byte)
connection_unix.go:408
↓ 43 callersFunctionRun
Run starts handling events on the specified address. Address should use a scheme prefix and be formatted like `tcp://192.168.0.10:9851` or `unix://so
gnet.go:690
↓ 43 callersMethodWrite
Write writes len(p) bytes from p to the underlying buf. It returns the number of bytes written from p (n == len(p) > 0) and any error encountered that
pkg/buffer/ring/ring_buffer.go:217
↓ 42 callersMethodBytes
Bytes returns all available read bytes. It does not move the read pointer and only copy the available data.
pkg/buffer/ring/ring_buffer.go:317
↓ 41 callersMethodRemoteAddr
RemoteAddr is the connection's remote address, it's not concurrency-safe, you must invoke it and use the returned value within any method in EventHand
gnet.go:459
↓ 34 callersMethodLocalAddr
LocalAddr is the connection's local socket address, it's not concurrency-safe, you must invoke it and use the returned value within any method in Even
gnet.go:453
↓ 33 callersMethodPeek
Peek returns the next n bytes without advancing the inbound buffer, the returned bytes remain valid until a Discard is called. buf must neither be use
gnet.go:250
↓ 32 callersMethodErrorf
Errorf logs messages at ERROR level.
pkg/logging/logger.go:290
↓ 31 callersMethodDiscard
Discard advances the inbound buffer with next n bytes, returning the number of bytes discarded.
gnet.go:253
↓ 30 callersMethodRead
(p []byte)
connection_unix.go:314
↓ 30 callersMethodRead
Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if Read returns n < len(p
pkg/buffer/ring/ring_buffer.go:151
↓ 29 callersFunctionWithTicker
WithTicker indicates whether a ticker is currently set.
options.go:269
↓ 27 callersMethodReset
Reset the read pointer and write pointer to zero.
pkg/buffer/ring/ring_buffer.go:482
↓ 25 callersMethodPut
Put returns the byte slice to the pool.
pkg/pool/byteslice/byteslice.go:60
↓ 24 callersMethodDial
Dial is like net.Dial().
client_unix.go:180
↓ 21 callersFunctionDebugf
Debugf logs messages at DEBUG level.
pkg/logging/logger.go:247
↓ 21 callersMethodGet
Get retrieves a byte slice of the length requested by the caller from pool or allocates a new one.
pkg/pool/byteslice/byteslice.go:44
↓ 21 callersMethodgetLogger
()
eventloop_unix.go:92
↓ 18 callersMethodConnMatrixRow
ConnMatrixRow returns the connMatrix row index.
internal/gfd/gfd.go:63
↓ 17 callersMethodDone
Done checks and returns the internal ring-buffer to pool.
pkg/buffer/elastic/elastic_ring_buffer.go:39
↓ 17 callersMethodNext
Next returns the next n bytes and advances the inbound buffer. buf must not be used in a new goroutine. Otherwise, use Read instead. If the number of
gnet.go:241
↓ 16 callersMethodIsFull
IsFull tells if this ring-buffer is full.
pkg/buffer/ring/ring_buffer.go:472
↓ 15 callersMethodTrigger
Trigger enqueues task and wakes up the poller to process pending tasks. By default, any incoming task will enqueued into urgentAsyncTaskQueue before t
pkg/netpoll/poller_epoll_default.go:90
↓ 14 callersMethodDequeue
()
pkg/queue/queue.go:45
↓ 14 callersMethodLen
Len returns the length of the underlying buffer.
pkg/buffer/ring/ring_buffer.go:286
↓ 14 callersMethodclose
()
listener_unix.go:72
↓ 13 callersMethodDebugf
Debugf logs messages at DEBUG level.
pkg/logging/logger.go:284
↓ 13 callersMethodlen
()
load_balancer.go:46
↓ 13 callersMethodshutdown
shutdown signals the engine to shut down.
engine_unix.go:55
↓ 12 callersFunctionNew
New returns a new Buffer whose buffer has the given size.
pkg/buffer/ring/ring_buffer.go:57
↓ 12 callersMethodSafeContext
SafeContext is the concurrency-safe version of Context that can be invoked on any goroutine.
gnet.go:435
↓ 12 callersMethodSetSafeContext
SetSafeContext is the concurrency-safe version of SetContext that can be invoked on any goroutine.
gnet.go:447
↓ 12 callersMethodStop
Stop gracefully shuts down this Engine without interrupting any active event-loops, it waits indefinitely for connections and event-loops to be closed
gnet.go:153
↓ 12 callersMethodWritev
Writev writes multiple byte slices to remote synchronously, it's not concurrency-safe, you must invoke it within any method in EventHandler.
gnet.go:273
↓ 12 callersFunctionnewStreamConn
(proto string, fd int, el *eventloop, sa unix.Sockaddr, localAddr, remoteAddr net.Addr)
connection_unix.go:59
↓ 12 callersFunctiontestServeGC
(t *testing.T, network, addr string, multicore, async bool, elNum int, initConnCount int32)
eventloop_unix_test.go:218
↓ 12 callersFunctiontestStreamProxyServer
(t *testing.T, addr string, backendServers []string, multicore, et bool)
gnet_test.go:2410
↓ 11 callersMethodConnMatrixColumn
ConnMatrixColumn returns the connMatrix column index.
internal/gfd/gfd.go:68
↓ 11 callersMethodRead
Read reads data from the Buffer.
pkg/buffer/linkedlist/linked_list_buffer.go:43
↓ 11 callersFunctionparseProtoAddr
(protoAddr string)
gnet.go:762
↓ 10 callersFunctionCeilToPowerOfTwo
CeilToPowerOfTwo returns n if it is a power-of-two, otherwise the next-highest power-of-two.
pkg/math/math.go:31
↓ 10 callersMethodContext
all methods in Socket are concurrency-safe. Context returns a user-defined context, it's not concurrency-safe, you must invoke it within any method in
gnet.go:431
↓ 10 callersMethodDup
Dup returns a copy of the underlying file descriptor. It is the caller's responsibility to close fd when finished. Closing c does not affect fd, and c
gnet.go:326
↓ 10 callersMethodEnqueue
(*Task)
pkg/queue/queue.go:44
↓ 10 callersMethodisShutdown
()
engine_unix.go:50
↓ 9 callersMethodCap
Cap returns the size of the underlying buffer.
pkg/buffer/ring/ring_buffer.go:291
↓ 9 callersFunctionErrorf
Errorf logs messages at ERROR level.
pkg/logging/logger.go:268
↓ 9 callersFunctionGetDefaultLogger
GetDefaultLogger returns the default logger.
pkg/logging/logger.go:175
↓ 9 callersFunctionNewLockFreeQueue
NewLockFreeQueue instantiates and returns a lockFreeQueue.
pkg/queue/lock_free_queue.go:98
↓ 9 callersMethodPushBack
PushBack is a wrapper of pushBack, which accepts []byte as its argument.
pkg/buffer/linkedlist/linked_list_buffer.go:108
↓ 9 callersMethodRegister
Register connects to the given address and registers the connection to the current event-loop, it's concurrency-safe.
gnet.go:404
↓ 9 callersFunctionconvertPollAttachment
(ptr unsafe.Pointer, attachment *PollAttachment)
pkg/netpoll/poller_unix_ultimate.go:21
↓ 9 callersMethoditerate
(func(int, *eventloop) bool)
load_balancer.go:45
↓ 9 callersFunctionrunSimServer
(t *testing.T, addr string, et bool, nclients, packetSize, batchWrite, batchRead int)
gnet_test.go:1943
↓ 8 callersMethodBuffered
Buffered returns the length of available bytes to read.
pkg/buffer/elastic/elastic_ring_buffer.go:121
↓ 8 callersMethodEventLoop
EventLoop returns the event-loop that the connection belongs to. The returned EventLoop is concurrency-safe.
gnet.go:439
↓ 8 callersFunctionGetDefaultFlusher
GetDefaultFlusher returns the default flusher.
pkg/logging/logger.go:182
↓ 8 callersFunctionPutTask
PutTask puts the trashy Task back in pool.
pkg/queue/queue.go:37
↓ 8 callersMethodRead
Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if Read returns n < len(p
pkg/buffer/elastic/elastic_ring_buffer.go:83
↓ 8 callersMethodReset
Reset removes all elements from this list.
pkg/buffer/linkedlist/linked_list_buffer.go:261
↓ 8 callersFunctionSetDefaultLoggerAndFlusher
SetDefaultLoggerAndFlusher sets the default logger and its flusher.
pkg/logging/logger.go:189
↓ 8 callersFunctionWithMulticore
WithMulticore enables multi-cores mode for gnet engine.
options.go:170
↓ 8 callersFunctionnewUDPConn
(fd int, el *eventloop, localAddr net.Addr, sa unix.Sockaddr, connected bool)
connection_unix.go:74
↓ 8 callersMethodpop
pop returns and removes the head of l. If l is empty, it returns nil.
pkg/buffer/linkedlist/linked_list_buffer.go:272
↓ 8 callersMethodregister
(*eventloop)
load_balancer.go:42
↓ 8 callersFunctiontestUDPProxyServer
(t *testing.T, addr string, backendServers []string, multicore, et bool)
gnet_test.go:2677
↓ 7 callersMethodBuffered
Buffered returns the number of bytes that can be read from the current buffer.
pkg/buffer/linkedlist/linked_list_buffer.go:251
↓ 7 callersMethodFatalf
Fatalf logs messages at FATAL level.
pkg/logging/logger.go:292
↓ 7 callersMethodPolling
Polling blocks the current goroutine, monitoring the registered file descriptors and waiting for network I/O. When I/O occurs on any of the file descr
pkg/netpoll/poller_epoll_default.go:115
↓ 7 callersMethodSetContext
SetContext sets a user-defined context, it's not concurrency-safe, you must invoke it within any method in EventHandler.
gnet.go:443
↓ 7 callersFunctionWithEdgeTriggeredIO
WithEdgeTriggeredIO enables the edge-triggered I/O for the underlying epoll/kqueue event-loop.
options.go:314
↓ 7 callersFunctionWithLockOSThread
WithLockOSThread enables LockOSThread mode for I/O event-loops.
options.go:177
↓ 7 callersFunctionWithTCPKeepAlive
WithTCPKeepAlive enables the TCP keep-alive mechanism and sets its values.
options.go:226
↓ 7 callersMethodWrite
(p []byte)
connection_windows.go:225
↓ 7 callersFunctionload
(p *unsafe.Pointer)
pkg/queue/lock_free_queue.go:165
↓ 7 callersMethodnext
(net.Addr)
load_balancer.go:43
↓ 6 callersMethodAsyncWrite
AsyncWrite writes bytes to remote asynchronously, it's concurrency-safe, you don't have to invoke it within any method in EventHandler, usually you wo
gnet.go:292
↓ 6 callersMethodBuffered
Buffered returns the number of bytes that can be read from the current buffer.
pkg/buffer/elastic/elastic_ring_list_buffer.go:154
↓ 6 callersMethodDupListener
DupListener is like Dup, but it duplicates the listener with the given network and address. This is useful when there are multiple listeners.
gnet.go:137
↓ 6 callersMethodOnTraffic
OnTraffic fires when a socket receives data from the remote. Also check out the comments on Reader and Writer interfaces.
gnet.go:509
↓ 6 callersMethodSetKeepAlive
SetKeepAlive enables/disables the TCP keepalive with all socket options: TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT. idle is the value for TCP_KEEPID
gnet.go:367
↓ 6 callersFunctionStringToBytes
StringToBytes converts string to a byte slice without any memory allocation.
pkg/bs/bs.go:28
↓ 6 callersFunctionSysClose
(fd int)
os_windows_test.go:9
↓ 6 callersMethodWake
Wake triggers an OnTraffic event for the current connection, it's concurrency-safe.
gnet.go:462
↓ 6 callersFunctionWithReusePort
WithReusePort sets SO_REUSEPORT socket option.
options.go:212
↓ 6 callersMethodWrite
Write writes len(p) bytes from p to the underlying buf. It returns the number of bytes written from p (n == len(p) > 0) and any error encountered that
pkg/buffer/elastic/elastic_ring_buffer.go:108
↓ 6 callersMethodclose
(c *conn, err error)
eventloop_unix.go:363
↓ 6 callersFunctionepollCtl
(epfd int, op int, fd int, event *epollevent)
pkg/netpoll/syscall_epoll_linux.go:25
↓ 6 callersFunctionexecSockOpts
(fd int, opts []Option[T])
pkg/socket/socket.go:33
↓ 6 callersMethodrelease
()
connection_unix.go:92
↓ 6 callersFunctiontestMulticast
(t *testing.T, addr string, reuseport, reuseaddr bool, index, nclients int)
os_unix_test.go:78
↓ 6 callersMethodwrite
(data []byte)
connection_unix.go:142
next →1–100 of 759, ranked by callers