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
MobiusMei
ygopro
Commits
61d65745
Commit
61d65745
authored
Oct 21, 2013
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
f64b2f8a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
gframe/game.cpp
gframe/game.cpp
+1
-1
gframe/netserver.cpp
gframe/netserver.cpp
+6
-2
gframe/netserver.h
gframe/netserver.h
+1
-1
No files found.
gframe/game.cpp
View file @
61d65745
...
...
@@ -35,7 +35,7 @@ unsigned char draw_count;
void
Game
::
MainServerLoop
(
int
bDuel_mode
)
{
deckManager
.
LoadLFList
();
dataManager
.
LoadDB
(
"cards.cdb"
);
NetServer
::
StartServer
(
aServerPort
);
aServerPort
=
NetServer
::
StartServer
(
aServerPort
);
printf
(
"%u
\n
"
,
aServerPort
);
NetServer
::
Initduel
(
bDuel_mode
);
while
(
NetServer
::
net_evbase
)
{
...
...
gframe/netserver.cpp
View file @
61d65745
...
...
@@ -56,7 +56,7 @@ void NetServer::Initduel(int bDuel_mode)
bool
NetServer
::
StartServer
(
unsigned
short
port
)
{
unsigned
short
NetServer
::
StartServer
(
unsigned
short
port
)
{
if
(
net_evbase
)
return
false
;
net_evbase
=
event_base_new
();
...
...
@@ -75,9 +75,13 @@ bool NetServer::StartServer(unsigned short port) {
net_evbase
=
0
;
return
false
;
}
evutil_socket_t
fd
=
evconnlistener_get_fd
(
listener
);
socklen_t
addrlen
=
sizeof
(
struct
sockaddr
);
struct
sockaddr_in
addr
;
getsockname
(
fd
,(
struct
sockaddr
*
)
&
addr
,
&
addrlen
);
evconnlistener_set_error_cb
(
listener
,
ServerAcceptError
);
Thread
::
NewThread
(
ServerThread
,
net_evbase
);
return
true
;
return
ntohs
(
addr
.
sin_port
)
;
}
bool
NetServer
::
StartBroadcast
()
{
if
(
!
net_evbase
)
...
...
gframe/netserver.h
View file @
61d65745
...
...
@@ -25,7 +25,7 @@ private:
public:
static
event_base
*
net_evbase
;
static
void
Initduel
(
int
duel_mode
);
static
bool
StartServer
(
unsigned
short
port
);
static
unsigned
short
StartServer
(
unsigned
short
port
);
static
bool
StartBroadcast
();
static
void
StopServer
();
static
void
StopBroadcast
();
...
...
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