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
REIKAI
ygopro
Commits
75b4f7c5
Commit
75b4f7c5
authored
Sep 14, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch' of github.com:edo9300/ygopro
parents
5dcb50e4
76d61cf1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
gframe/duelclient.cpp
gframe/duelclient.cpp
+9
-4
gframe/duelclient.h
gframe/duelclient.h
+2
-1
gframe/netserver.cpp
gframe/netserver.cpp
+1
-0
No files found.
gframe/duelclient.cpp
View file @
75b4f7c5
...
@@ -35,7 +35,7 @@ bool DuelClient::is_refreshing = false;
...
@@ -35,7 +35,7 @@ bool DuelClient::is_refreshing = false;
int
DuelClient
::
match_kill
=
0
;
int
DuelClient
::
match_kill
=
0
;
std
::
vector
<
HostPacket
>
DuelClient
::
hosts
;
std
::
vector
<
HostPacket
>
DuelClient
::
hosts
;
std
::
vector
<
std
::
wstring
>
DuelClient
::
hosts_srvpro
;
std
::
vector
<
std
::
wstring
>
DuelClient
::
hosts_srvpro
;
std
::
set
<
unsigned
int
>
DuelClient
::
remotes
;
std
::
set
<
std
::
pair
<
unsigned
int
,
unsigned
short
>
>
DuelClient
::
remotes
;
event
*
DuelClient
::
resp_event
=
0
;
event
*
DuelClient
::
resp_event
=
0
;
unsigned
int
DuelClient
::
temp_ip
=
0
;
unsigned
int
DuelClient
::
temp_ip
=
0
;
unsigned
short
DuelClient
::
temp_port
=
0
;
unsigned
short
DuelClient
::
temp_port
=
0
;
...
@@ -4309,11 +4309,16 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
...
@@ -4309,11 +4309,16 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
socklen_t
sz
=
sizeof
(
sockaddr_in
);
socklen_t
sz
=
sizeof
(
sockaddr_in
);
char
buf
[
256
];
char
buf
[
256
];
/*int ret = */
recvfrom
(
fd
,
buf
,
256
,
0
,
(
sockaddr
*
)
&
bc_addr
,
&
sz
);
/*int ret = */
recvfrom
(
fd
,
buf
,
256
,
0
,
(
sockaddr
*
)
&
bc_addr
,
&
sz
);
unsigned
int
ipaddr
=
bc_addr
.
sin_addr
.
s_addr
;
HostPacket
*
pHP
=
(
HostPacket
*
)
buf
;
HostPacket
*
pHP
=
(
HostPacket
*
)
buf
;
if
(
!
is_closing
&&
pHP
->
identifier
==
NETWORK_SERVER_ID
&&
remotes
.
find
(
ipaddr
)
==
remotes
.
end
()
)
{
if
(
is_closing
||
pHP
->
identifier
!=
NETWORK_SERVER_ID
)
return
;
//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
();
mainGame
->
gMutex
.
lock
();
remotes
.
insert
(
ipaddr
);
remotes
.
insert
(
remote
);
pHP
->
ipaddr
=
ipaddr
;
pHP
->
ipaddr
=
ipaddr
;
hosts
.
push_back
(
*
pHP
);
hosts
.
push_back
(
*
pHP
);
std
::
wstring
hoststr
;
std
::
wstring
hoststr
;
...
...
gframe/duelclient.h
View file @
75b4f7c5
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include "config.h"
#include "config.h"
#include <vector>
#include <vector>
#include <set>
#include <set>
#include <utility>
#include <event2/event.h>
#include <event2/event.h>
#include <event2/listener.h>
#include <event2/listener.h>
#include <event2/bufferevent.h>
#include <event2/bufferevent.h>
...
@@ -90,7 +91,7 @@ protected:
...
@@ -90,7 +91,7 @@ protected:
static
bool
is_refreshing
;
static
bool
is_refreshing
;
static
int
match_kill
;
static
int
match_kill
;
static
event
*
resp_event
;
static
event
*
resp_event
;
static
std
::
set
<
unsigned
int
>
remotes
;
static
std
::
set
<
std
::
pair
<
unsigned
int
,
unsigned
short
>
>
remotes
;
public:
public:
static
std
::
vector
<
HostPacket
>
hosts
;
static
std
::
vector
<
HostPacket
>
hosts
;
static
std
::
vector
<
std
::
wstring
>
hosts_srvpro
;
static
std
::
vector
<
std
::
wstring
>
hosts_srvpro
;
...
...
gframe/netserver.cpp
View file @
75b4f7c5
...
@@ -42,6 +42,7 @@ bool NetServer::StartBroadcast() {
...
@@ -42,6 +42,7 @@ bool NetServer::StartBroadcast() {
SOCKET
udp
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
SOCKET
udp
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
BOOL
opt
=
TRUE
;
BOOL
opt
=
TRUE
;
setsockopt
(
udp
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
));
setsockopt
(
udp
,
SOL_SOCKET
,
SO_BROADCAST
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
));
setsockopt
(
udp
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
const
char
*
)
&
opt
,
sizeof
(
BOOL
));
sockaddr_in
addr
;
sockaddr_in
addr
;
memset
(
&
addr
,
0
,
sizeof
(
addr
));
memset
(
&
addr
,
0
,
sizeof
(
addr
));
addr
.
sin_family
=
AF_INET
;
addr
.
sin_family
=
AF_INET
;
...
...
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