Commit 6f71a96de1e398422e17ea0a763a2b67e3b23d49

Authored by dg
1 parent b1963222

plop


git-svn-id: http://svn.net-core.org/repos/t-engine4@2890 51575b47-30f0-44d4-a5cc-537603b46e54
... ... @@ -120,6 +120,7 @@ function _M:pread(ncode)
120 120 end
121 121
122 122 function _M:login()
  123 +print("profile login", self.sock , self.auth , self.user_login , self.user_pass)
123 124 if self.sock and not self.auth and self.user_login and self.user_pass then
124 125 self:command("AUTH", self.user_login)
125 126 self:read("200")
... ... @@ -193,6 +194,7 @@ function _M:run()
193 194 end
194 195
195 196 function _M:handleOrder(o)
  197 + print("==== profile order ====", o)
196 198 o = o:unserialize()
197 199 if not self.sock and o.o ~= "Login" and o.o ~= "CurrentCharacter" and o.o ~= "CheckModuleHash" then return end -- Dont do stuff without a connection, unless we try to auth
198 200 if self["order"..o.o] then self["order"..o.o](self, o) end
... ... @@ -212,13 +214,15 @@ function _M:orderNewProfile2(o)
212 214 end
213 215
214 216 function _M:orderLogin(o)
  217 + self.user_login = o.l
  218 + self.user_pass = o.p
  219 + print("profile strogin login info", o.l, o.p)
  220 +
215 221 -- Already logged?
216 222 if self.auth and self.auth.login == o.l then
217 223 print("[PROFILE] reusing login", self.auth.name)
218 224 cprofile.pushEvent(string.format("e='Auth' ok=%q", table.serialize(self.auth)))
219 225 else
220   - self.user_login = o.l
221   - self.user_pass = o.p
222 226 self:login()
223 227 end
224 228 end
... ... @@ -314,7 +318,9 @@ end
314 318
315 319 function _M:orderChatJoin(o)
316 320 self:command("JOIN", o.channel)
317   - self:read("200")
  321 + if self:read("200") then
  322 + self.chat:joined(o.channel)
  323 + end
318 324 end
319 325
320 326 function _M:orderChatUserInfo(o)
... ...
... ... @@ -25,6 +25,7 @@ local c = Client.new()
25 25 function step_profile()
26 26 local ok, res = xpcall(function() return c:run() end, function(...) server:logError("[profile-thread-error:stacktrace] %s", debug.traceback(...)) end)
27 27 if not ok and res then
  28 + print("[PROFILE THREAD] error", res)
28 29 return false
29 30 end
30 31 return res
... ...
... ... @@ -67,6 +67,7 @@ int pop_order(lua_State *L)
67 67
68 68 if (q)
69 69 {
  70 +// printf("[profile event] POP %s\n", q->payload);
70 71 lua_pushlstring(L, q->payload, q->payload_len);
71 72 free(q->payload);
72 73 free(q);
... ... @@ -141,11 +142,6 @@ int thread_profile(void *data)
141 142 luaL_openlib(L, "cprofile", threadlib, 0); lua_pop(L, 1);
142 143
143 144 profile->L = L;
144   - profile->iqueue_head = profile->iqueue_tail = profile->oqueue_head = profile->oqueue_tail = NULL;
145   - profile->lock_iqueue = SDL_CreateMutex();
146   - profile->wait_iqueue = SDL_CreateSemaphore(0);
147   - profile->lock_oqueue = SDL_CreateMutex();
148   - profile->wait_oqueue = SDL_CreateSemaphore(0);
149 145
150 146 // And run the lua engine pre init scripts
151 147 if (!luaL_loadfile(L, "/loader/pre-init.lua")) docall(L, 0, 0);
... ... @@ -180,6 +176,11 @@ int create_profile_thread(lua_State *L)
180 176 main_profile = profile;
181 177
182 178 profile->running = TRUE;
  179 + profile->iqueue_head = profile->iqueue_tail = profile->oqueue_head = profile->oqueue_tail = NULL;
  180 + profile->lock_iqueue = SDL_CreateMutex();
  181 + profile->wait_iqueue = SDL_CreateSemaphore(0);
  182 + profile->lock_oqueue = SDL_CreateMutex();
  183 + profile->wait_oqueue = SDL_CreateSemaphore(0);
183 184
184 185 thread = SDL_CreateThread(thread_profile, profile);
185 186 if (thread == NULL) {
... ...