-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P2P game networking through Steam Datagram Relay #384
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
Signed-off-by: Michael Pollind <mpollind@gmail.com>
int i, num_max; | ||
unsigned line_height; | ||
int xoffset, yoffset = 0; | ||
struct shader_s *pic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to reuse variables?
static void SV_P2P_NewConnection( void *self, struct steam_evt_pkt_s *evt ) | ||
{ | ||
struct p2p_new_connection_evt_s *p2p = &evt->p2p_new_connection; | ||
|
||
// find a free slot | ||
int free = -1; | ||
for( int i = 0; i < MAX_INCOMING_CONNECTIONS; i++ ) { | ||
if( !svs.incomingp2p[i].active ) { | ||
free = i; | ||
break; | ||
} | ||
} | ||
if( free == -1 ) { | ||
Com_Printf( "No free slot for P2P connection\n" ); | ||
return; | ||
} | ||
printf("New %i P2P connection from %llu\n", free, p2p->steamID); | ||
|
||
incoming_t *inc = &svs.incomingp2p[free]; | ||
netadr_t address; | ||
NET_InitAddress( &address, NA_SDR ); | ||
address.address.steamid = p2p->steamID; | ||
|
||
inc->active = true; | ||
inc->time = svs.realtime; | ||
inc->address = address; | ||
|
||
inc->socket.address = address; | ||
inc->socket.type = SOCKET_SDR; | ||
inc->socket.handle = p2p->handle; | ||
inc->socket.server = true; | ||
inc->socket.open = true; | ||
inc->socket.connected = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: fomatting is a bit funny. maybe change it to all to space or tabs looks.
template <typename T> | ||
static inline void write_packet( PipeType fd, const T *response, uint32_t size ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The template might not be necessary? can you use a void pointer the type is not used for the body of the function.
No description provided.