Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
K'van
Tales of MajEyal
Commits
cc9f6644
Commit
cc9f6644
authored
14 years ago
by
dg
Browse files
Options
Downloads
Patches
Plain Diff
plop
git-svn-id:
http://svn.net-core.org/repos/t-engine4@2771
51575b47-30f0-44d4-a5cc-537603b46e54
parent
ef2db827
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
game/engines/default/engine/PlayerProfile.lua
+5
-0
5 additions, 0 deletions
game/engines/default/engine/PlayerProfile.lua
game/profile-thread/Client.lua
+42
-5
42 additions, 5 deletions
game/profile-thread/Client.lua
with
47 additions
and
5 deletions
game/engines/default/engine/PlayerProfile.lua
+
5
−
0
View file @
cc9f6644
...
...
@@ -376,6 +376,11 @@ function _M:eventGetNews(e)
end
end
function
_M
:
eventPushCode
(
e
)
local
f
=
loadstring
(
e
.
code
)
if
f
then
pcall
(
f
)
end
end
function
_M
:
eventGetConfigs
(
e
)
local
data
=
e
.
data
:
unserialize
()
local
module
=
e
.
module
...
...
This diff is collapsed.
Click to expand it.
game/profile-thread/Client.lua
+
42
−
5
View file @
cc9f6644
...
...
@@ -41,7 +41,7 @@ function _M:connectedPull()
self
.
psock
=
socket
.
connect
(
"te4.org"
,
2258
)
if
not
self
.
psock
then
return
false
end
print
(
"[PROFILE] Pull socket connected to te4.org"
)
--
self.psock:send(
"
self
.
psock
:
send
(
self
.
auth
.
push_id
..
"
\n
"
)
-- Identify ourself
return
true
end
...
...
@@ -70,6 +70,21 @@ function _M:read(ncode)
return
l
end
function
_M
:
pread
(
ncode
)
local
l
,
err
=
self
.
psock
:
receive
(
"*l"
)
if
not
l
then
if
err
==
"closed"
then
print
(
"[PROFILE] push connection disrupted, trying to reconnect"
,
err
)
self
:
disconnect
()
end
return
nil
end
if
ncode
and
l
:
sub
(
1
,
3
)
~=
ncode
then
return
nil
,
"bad code"
end
return
l
end
function
_M
:
login
()
if
self
.
sock
and
not
self
.
auth
and
self
.
user_login
and
self
.
user_pass
then
self
:
command
(
"AUTH"
,
self
.
user_login
)
...
...
@@ -79,6 +94,7 @@ function _M:login()
print
(
"[PROFILE] logged in!"
,
self
.
user_login
)
self
.
auth
=
self
.
last_line
:
unserialize
()
cprofile
.
pushEvent
(
string.format
(
"e='Auth' ok=%q"
,
self
.
last_line
))
self
:
connectedPull
()
return
true
else
print
(
"[PROFILE] could not log in"
)
...
...
@@ -96,10 +112,18 @@ end
function
_M
:
step
()
if
self
:
connected
()
then
local
rready
=
socket
.
select
({
self
.
sock
},
nil
,
0
)
if
rready
[
self
.
sock
]
then
local
l
=
self
:
read
()
if
l
then
print
(
"GOT: "
,
l
)
end
local
rready
=
socket
.
select
({
self
.
psock
},
nil
,
0
)
if
rready
[
self
.
psock
]
then
local
l
=
self
:
pread
()
if
l
then
local
code
=
l
:
sub
(
1
,
3
)
local
data
=
l
:
sub
(
5
)
print
(
"<<<<<<<"
,
code
,
"::"
,
data
)
if
code
==
"101"
then
local
e
=
data
:
unserialize
()
if
e
and
e
.
e
and
self
[
"push"
..
e
.
e
]
then
self
[
"push"
..
e
.
e
](
self
,
e
)
end
end
end
end
return
true
end
...
...
@@ -224,3 +248,16 @@ function _M:handleOrder(o)
if
not
self
.
sock
and
o
.
o
~=
"Login"
then
return
end
-- Dont do stuff without a connection, unless we try to auth
if
self
[
"order"
..
o
.
o
]
then
self
[
"order"
..
o
.
o
](
self
,
o
)
end
end
--------------------------------------------------------------------
-- Pushes comming from the push socket
--------------------------------------------------------------------
function
_M
:
pushCode
(
o
)
if
o
.
profile
then
local
f
=
loadstring
(
o
.
code
)
if
f
then
pcall
(
f
)
end
else
cprofile
.
pushEvent
(
string.format
(
"e='PushCode' code=%q"
,
o
.
code
))
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment