Commit Graph

23 Commits

Author SHA1 Message Date
Kevin Wang
be0657f17b Fix lint errors 2025-08-16 23:35:36 -04:00
Joe Turki
cad1676659 Upgrade golangci-lint, more linters
Introduces new linters, upgrade golangci-lint to version (v1.63.4)
2025-01-17 08:21:15 -06:00
cnderrauber
cb8a47ac37 Refine TCPMux memory usage
Reduce read buf of first stun message.
Add timeout to read first message to clean interrupted
connection earlier.
Add alive duration for gather to access connection created
from stun bind, avoid connection leak from malicious client.
2024-02-22 11:37:13 +08:00
Ondrej Sery
dbdc6bdf02 Only report closure errors for the last connection
Safari and iOS Chrome (WebKit) sometimes open multiple TCP
connections that end up being part of the same tcpPacketConn
object in TCPMuxDefault. After some time, the extra connection
is closed even though the main one is still operational. In this
case, the entire peer connection gets disconnected. Instead, we
probably only want to close the entire connection only once there
is no other open TCP connection (this PR).

To be honest, I am not sure why Safari and iOS Chrome do this.
However, there is probably no chance fixing it there.
2023-09-07 22:21:13 -07:00
renovate[bot]
d21edf9690 Start pion/ice@v3
This is required to update pion/transport/v2 to v3

The public API of transport changed, and we expose transport as part of
our public API.
2023-09-03 23:51:36 -04:00
Steffen Vogel
8d14c1f2e7 Harmonize errors and error logging
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
2023-07-18 07:48:09 +02:00
Steffen Vogel
53beccaed5 Harmonize capitalization of log messages 2023-07-04 05:15:54 +02:00
Steffen Vogel
f40dd65abb Fix comment capitalization
Comments should start with an uppercase letter.
2023-04-18 19:38:54 +02:00
Steffen Vogel
5ef81b65f4 Make package REUSE compliant 2023-04-18 13:46:38 +02:00
Steffen Vogel
c6c0a15708 Fix new golangci-lint errors 2023-04-12 09:27:03 +02:00
Steffen Vogel
0194bd6ce8 Use new pion/transport Net interface
This change adapts pion/ice to use a new interface for most network
related operations. The interface was formerly a simple struct vnet.Net
which was originally intended to facilicate testing. By replacing it
with an interface we have greater flexibility and allow users to hook
into the networking stack by providing their own implementation of
the interface.
2023-02-08 21:58:49 +01:00
Steffen Vogel
d415139840 Refactor variable names from buffer to buf
Go encourages short names. And a quick
survey through the Pion code bases reveals,
that we have been using buf more often than buffer.
So this change will harmonize the different spellings.
2022-11-13 21:56:24 +01:00
Steffen Vogel
dc5bce4401 Refactor variable names {r,s}addr to {r,s}Addr
As most variables are using camelCase.
2022-11-13 21:56:24 +01:00
David Zhao
a705a5f294 Minor fix: incorrect log format in TCPMux
%w isn't a correct formatting string for error types.
2022-10-06 22:38:25 -07:00
cnderrauber
93980395c8 Fix muxed conn shared by candidate
When we have multiple host candidates and mux to a
single port, if these candidates share a same conn
(either tcp or udp), they might read other's msg
cause ice connection cost long time or failed.
2022-09-26 09:26:23 +08:00
Kevin Caffrey
5475fdb796 Attempt to fix deadlock in TCPMux
Previously `(*TCPMux).RemoveConnByUfrag` would close the connections
while holding its lock, but it is possible for closing to block
and/or take a while.

If closing one of the connections blocks (which was occurring rarely
due to blocking on a channel send), then the entire `TCPMux` would
deadlock and all further operations with the ICE agent would end
up getting blocked due to tying up the task loop.

This change should help matters, but it's unclear if
`(*TCPMux).RemoveConnByUfrag` somehow needs to be made cancelable by
`Agent`'s task context, as there are no guarantees that closing
a connection will happen quickly.
2022-09-17 09:40:57 -04:00
cnderrauber
90dc7280e2 Add nonblock write option to TCPMux
add nonblock write option for sfu broadcast don't want
slow connetion affect other clients.
2022-07-20 14:33:39 +08:00
Steffen Vogel
e32a520e4c Do not use newlines in logging statements
A newline is automatically added by the DefaultLeveledLogger.
The current code-base used a mix of log statements w/o endlines.
This is misleading for custom loggers.
2022-05-08 22:53:42 -04:00
David Zhao
b73472ee7e Reduce critical section when writing with TCPMux
To avoid one bad connection causing locked processes/cascading failures.
2022-04-05 23:25:38 -07:00
Pion
d3e1775d73 Update CI configs to v0.4.7
Update lint scripts and CI configs.
2020-09-26 08:54:24 -07:00
Jerko Steiner
fa49161dd0 Close TCP recvChan after all writes have completed
Closes #260
2020-08-09 13:55:49 +02:00
Jerko Steiner
3b9a989177 Remove global state for ICE TCP
This addresses a few points issue of #245:

 - Take a net.Listener instead of having global state
 - Expose a net.TCPMux based API

Also, the unused closeChannel was removed from tcp_mux.go

Closes #253.
2020-08-01 09:28:28 +02:00
Jerko Steiner
12f44e93f1 Add support for passive ICE TCP candidate
Closes #196
2020-07-15 07:51:55 +02:00