Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
ygopro
Commits
6d7ff3fc
Commit
6d7ff3fc
authored
Sep 01, 2022
by
Edoardo Lolletti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support multiple lam rooms from the same ip on different ports
parent
ab330b7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
gframe/duelclient.cpp
gframe/duelclient.cpp
+9
-4
gframe/duelclient.h
gframe/duelclient.h
+2
-1
No files found.
gframe/duelclient.cpp
View file @
6d7ff3fc
...
...
@@ -34,7 +34,7 @@ mt19937 DuelClient::rnd;
bool
DuelClient
::
is_refreshing
=
false
;
int
DuelClient
::
match_kill
=
0
;
std
::
vector
<
HostPacket
>
DuelClient
::
hosts
;
std
::
set
<
unsigned
int
>
DuelClient
::
remotes
;
std
::
set
<
std
::
pair
<
unsigned
int
,
unsigned
short
>
>
DuelClient
::
remotes
;
event
*
DuelClient
::
resp_event
=
0
;
bool
DuelClient
::
StartClient
(
unsigned
int
ip
,
unsigned
short
port
,
bool
create_game
)
{
...
...
@@ -4031,11 +4031,16 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
socklen_t
sz
=
sizeof
(
sockaddr_in
);
char
buf
[
256
];
/*int ret = */
recvfrom
(
fd
,
buf
,
256
,
0
,
(
sockaddr
*
)
&
bc_addr
,
&
sz
);
unsigned
int
ipaddr
=
bc_addr
.
sin_addr
.
s_addr
;
if
(
is_closing
||
pHP
->
identifier
==
NETWORK_SERVER_ID
)
return
;
HostPacket
*
pHP
=
(
HostPacket
*
)
buf
;
if
(
!
is_closing
&&
pHP
->
identifier
==
NETWORK_SERVER_ID
&&
pHP
->
version
==
PRO_VERSION
&&
remotes
.
find
(
ipaddr
)
==
remotes
.
end
()
)
{
if
(
pHP
->
version
!=
PRO_VERSION
)
return
;
unsigned
int
ipaddr
=
bc_addr
.
sin_addr
.
s_addr
;
const
auto
remote
=
std
::
make_pair
(
ipaddr
,
pHP
->
port
);
if
(
remotes
.
find
(
remote
)
==
remotes
.
end
())
{
mainGame
->
gMutex
.
lock
();
remotes
.
insert
(
ipaddr
);
remotes
.
insert
(
remote
);
pHP
->
ipaddr
=
ipaddr
;
hosts
.
push_back
(
*
pHP
);
std
::
wstring
hoststr
;
...
...
gframe/duelclient.h
View file @
6d7ff3fc
...
...
@@ -4,6 +4,7 @@
#include "config.h"
#include <vector>
#include <set>
#include <utility>
#include <event2/event.h>
#include <event2/listener.h>
#include <event2/bufferevent.h>
...
...
@@ -76,7 +77,7 @@ protected:
static
bool
is_refreshing
;
static
int
match_kill
;
static
event
*
resp_event
;
static
std
::
set
<
unsigned
int
>
remotes
;
static
std
::
set
<
std
::
pair
<
unsigned
int
,
unsigned
short
>
>
remotes
;
public:
static
std
::
vector
<
HostPacket
>
hosts
;
static
void
BeginRefreshHost
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment