Commit Graph
48 Commits
Author SHA1 Message Date
Fletcher Dunn a0f7110104 Fix compiler warnings in test_p2p
P4:6653437
2021-07-06 15:35:34 -07:00
Fletcher Dunn f98cd32f62 Oops, I think this is the correct fix for OSX. 2021-04-02 17:28:29 -07:00
Lennart Haller 9dffeb46c8 Update trivial_signaling_client.cpp
OS X does not know "SOCK_NONBLOCK".
2021-04-02 16:55:09 -07:00
Fletcher Dunn ae52d2d0ce Refactor custom signaling
Removed the word "custom" from the namesofinterfacesthatwerealreadyverylong.

Added k_ESteamNetworkingConfig_Callback_CreateConnectionSignaling, which is
a mechanism for connections that require signaling to be iniated locally.
This is used by ISteamnetwrokingSockets::ConnectP2P and connections created
using the ISteamNetworkingMessages interface....which has been added.

These changes address issue #137 and bring the opensource code more in
line with Steamworks version.

Delete the define STEAMNETWORKINGSOCKETS_HAS_DEFAULT_P2P_SIGNALING.  "Default
signaling" is a thing that can exist on any platform, and can only be determined
at runtime.  Most places that were using this actually should have been
checking STEAMNETWORKINGSOCKETS_ENABLE_STEAMNETWORKINGMESSAGES anyway, and
those two defines were equivalent in practice.
STEAMNETWORKINGSOCKETS_ENABLE_STEAMNETWORKINGMESSAGES will be defined by default.
I could add a mechanism to disable it if anybody is relaly concerned about
code size.

(Also started some refactoring of the P2P listen sockets, to merge them
with hosted dedicated server listen sockets.  The goal is to enable a
way to connected to hosted dedicated servers without tickets.  That is a work
in progress, and also not relevant to the opensource code.)
2020-10-16 15:08:16 -07:00
Fletcher Dunn 22abd07690 Sockets are hard 2020-10-09 18:54:46 -07:00
Fletcher Dunn 515a34e3cc Fix winsock issues in trivial signaling client.
Use a queue.  Unfortunately, if you try to send while the socket is not
yet connected, winsock will not buffer it for you.
2020-10-09 18:31:14 -07:00
Fletcher Dunn aae577396f Use recursive_mutex 2020-10-09 18:01:13 -07:00
Andrew Simpson 34ead6c9e2 Fixes for WebRTC / vcpkg build
* Fixed installation with WebRTC is enabled
* Added vcpkg feature option for webrtc
* Try to detect abseil before using our own submodule copy (means we can use the one from vcpkg)
* Fixed standalone example build
* Shaved down abseil dependencies and use properly namespaced names
2020-10-06 16:28:48 -07:00
Steven Noonan 8348e9234a CMake: add support for LTO/LTCG/IPO/whatever-its-called-these-days
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-09-30 16:26:07 -07:00
Steven Noonan 133f0db27d examples: don't build signaling server example if go binary is absent
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-09-18 07:24:42 -07:00
Fletcher Dunn b29911db5b Don't build example P2P server unless USE_STEAMWEBRTC.
Fixes issue #139
2020-09-14 18:03:19 -07:00
Fletcher Dunn 1d11919760 Disable some warnings in tests/examples.
Refactored a bunch of common stuff into a function to do this
2020-09-03 16:29:37 -07:00
Steven Noonan 0eedd618eb CMakeLists: normalize indentation to editorconfig, NFC
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-09-03 15:31:44 -07:00
Steven Noonan 2a5bb4d0d7 trivial_signaling_server: run through gofmt
It's a good idea to follow the golang prescribed formatting.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-09-02 22:32:49 -07:00
Steven Noonan 3dba9c2dd1 examples: use find_program instead of find_library for go
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2020-09-02 21:43:09 -07:00
Fletcher Dunn a419be3d1f Fix win32 compile 2020-09-02 20:21:04 -07:00
Fletcher Dunn 39f14557fb Don't build golang example signaling server on Win32 2020-09-02 20:00:57 -07:00
Fletcher Dunn 9a67f2e05b Fix infinite loop bug in example client
This took me waaaaayyyyy too long to debug.
2020-09-02 09:55:22 -07:00
Fletcher Dunn e0deb8c9b8 Add spew 2020-09-01 15:24:23 -07:00
Fletcher Dunn 123a9f4e0c Fix missing return value 2020-09-01 12:24:39 -07:00
Fletcher Dunn 91b2a0352d Fix warning 2020-09-01 12:24:30 -07:00
Fletcher Dunn 381f7f3a15 Queue greeting immediately when connecting 2020-09-01 11:19:00 -07:00
Fletcher Dunn 174d27e707 Drop meson support
I don't want to learn or maintain two build systems.  cmake is the javascript
of cross-platform build systems:  Yes, it's weird and old and crusty and you
can point out all sorts of problems with it.  But it's also what the
community is consolidating on.
2020-08-31 17:16:29 -07:00
Fletcher Dunn 3d35c23835 Move all build output to bin folder.
Not scattered throughout the tree.  This makes it easier to run tests, etc.
2020-08-31 17:07:57 -07:00
Fletcher Dunn b81bdd6ac7 P2P test mostly written.
I really need to be able to compile the webrtc code with my version
of cmake to make further progress on this.
2020-08-31 14:57:40 -07:00
Fletcher Dunn cbefc8aebd Add trivial signaling client example.
WIP.  This compiles but hasn't been tested yet.  Working on a test case
that exercises it.

Also I'm still not sure I like the way the interfaces are organized.  It's
slightly more complicated than necessary, to handle what is probably a
relatively rare use case.  Maybe the only use case I care about is "Here
is the one and only signaling service to use" and I could essentially
combine ISteamNetworkingCustomSignalingRecvContext and
ISteamNetworkingCustomSignalingService.  You could replace the default
platform service, but not mix and match.
Or maybe the only thing that is needed is some comments clarifying
the relationship between ISteamNetworkingCustomSignalingRecvContext
and ISteamNetworkingCustomSignalingService.  In both cases, the primary
purpose is to create a signaling session for a specific connection.  But
one is for remotely initiated connections (a signal that respresents a
connect request coming in) and the other is for locally-initated
requests that do not go through ConnectP2PCustomSignaling.
2020-08-30 11:55:44 -07:00
Fletcher Dunn 56adfc7037 Add a comment to desribe what this is. 2020-08-29 21:33:44 -07:00
Fletcher Dunn f3b9884170 Add a trivial P2P signaling server.
It has a really dumb client protocol, no authentication, etc.  But
it should be sufficient to illustrate how a plugin for a real signaling
service (maybe XMPP or DERP) could be written.
2020-08-29 21:02:10 -07:00
Andrew Simpson 2d1ae278d5 Added ability to install GameNetworkingSockets from CMake
Also tweaked the example chat configuration so that it can be built standalone using the installed library.
2020-08-28 17:21:40 -07:00
Fletcher Dunn 4c71718263 Changed callback mechanism.
Now you can register standard function pointers, instead of deriving
from a special class.  This means that Steam and the opensource code
can now work the same, so this fixed issue #124
2020-07-03 18:02:21 -07:00
Fletcher Dunn a9e5e86b28 Added "poll group" interface.
This is used to poll many connections in a single function call.  Previously,
this was only possible if all of the connections were those accepted on the
same listen socket.  (ReceiveMessagesOnListenSocket).  But this left out at
least two important use cases with known users:

- If you create more than one listen socket (because there is more way to
  contact your service, e.g. once for P2P and another for direct IP, and
  another for relayed connections), then you could not poll all of the
  connections efficiently.
- In P2P use cases, we may initiate many connections to peers, and we want
  to poll all of them at once.

This change is relevant to: Issue #49, Issue #50, and issue #52.  (But I don't
this it really "fixes" any of them.)
2019-12-05 15:51:33 -08:00
Fletcher Dunn aa50330f1f Add method to send a messgae without copying payload.
Fixes #51
2019-09-23 14:13:08 -07:00
Fletcher Dunn 140498490e API to atomically set initial options.
Added a mechanism to set initial options when creating a listen socket or
connection.
2019-09-02 14:34:11 -07:00
Fletcher Dunn e8bba6ade1 Added interface for app to provision cert.
Also:
- STEAMNETWORKINGSOCKETS_STEAM now mens "running on steam", not "running using
  the steam client".  STEAMNETWORKINGSOCKETS_STEAMCLIENT is for that.
- Refactored stats stuff, moved it into the namespace.  At one point I thought
  I might expose some stuff in a public interface.  For now, keeping it internal.
- Removed concept of Steam "universe" from this branch of the code.
- Don't use OVERRIDE, override works.
2019-08-29 13:42:17 -07:00
Dedmen Miller 639c093138 Fix very minor typo 2019-03-20 12:56:46 +01:00
Fletcher Dunn cb911a0277 Adjusted hacks for running without Steam.
(No functional change for opensource version.)
2019-02-09 12:19:16 -08:00
Fletcher Dunn cf12240f9a Tweak init of test/example when linking with Steam.
(No functional change in this lib.)
2019-02-05 13:13:45 -08:00
Steven Noonan 04831cf688 silence some -Wswitch warnings
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2019-01-30 21:06:14 -08:00
Fletcher Dunn 5d20204781 Overhaul how configurtion options are set.
Moved them to ISteamNetworkingUtils, which is now actually shared Steam (mostly) with a real accessor and and interface, and not a dummy interface object with all static methods.

Connection settings have a system of inheritance, so they can be set globally, per SteamNetworkingSockets interface, per listen socket, or per connection.

Deleted the config variable to simulate fake *message* loss.  That is not useful.

Introduced STEAMNETWORKINGSOCKETS_ENABLE_SDR define, to make it more clear why code is being #ifdef'ed out.  (E.g. if we open-sourced that code, we would want that included.)

Replaced ESteamNetworkingSendType with a basic flags bitmask.

Cleaned up a bunch of comments.

Changed SteamNetworkingMessage_t release mechanism.  Now the callback is only to free the buffer, and it's assumed that this API will manage the actual objects.  (This is important because the actual type is a derived type and has extra stuff on the end.)  Also laid some groundwork for user management of message objects.  (Relevant for issue #51.)
2019-01-30 10:58:38 -08:00
Fletcher Dunn e2194a23c7 SetDebugOutputFunction cleanup.
Make it a method of ISteamnetworkingUtils method.  This matches Steam.

Make sure ESteamNetworkingSocketsDebugOutputType is 32-bits, and declare the output callback to take an enum instead of int.
2019-01-23 21:08:10 -08:00
Steven Noonan aad351d027 CMake: normalize indentation, add vim modelines
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2019-01-17 01:37:49 -08:00
Steven Noonan 1113cf75c7 cmake: add some helpers to find sanitizers
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2019-01-17 00:18:50 -08:00
Steven Noonan bd41f176bb example_chat: remove unused m_bConnected variable
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2019-01-16 23:50:37 -08:00
Steven Noonan 7f57036df0 meson: only create threads dependency once, use many times
Noticed that meson was repeatedly checking the dependency, when we only
really need to do that once and use it wherever it's needed.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2019-01-16 09:48:44 -08:00
Steven Noonan a419a955ea CMake: add example_chat target to build
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2019-01-15 13:21:50 -08:00
Steven Noonan 9e279cf10e meson: unify warning flags for project
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
2019-01-15 13:19:43 -08:00
Fletcher Dunn 104df063b1 Fix windows compile. 2019-01-12 17:49:56 -08:00
Fletcher Dunn 8085c9c549 Added a simple chat client/server example. 2019-01-12 17:00:06 -08:00