static BinaryStreamWriter GetMails_3(object __serviceObj, Session __client, BinaryStreamReader __reader) { var __timer = TimeCounter.BeginNew(); IMailServerImpl __service = (IMailServerImpl)__serviceObj; string userId; int __reqId; __reader.Read(out __reqId); __reader.Read(out userId); #if (DEBUG || LOG_PROTOCOL) Log.Debug("GetMails reqId: {0}, userId: {0}", __reqId, userId); #endif var reply = new IMailServer_GetMailsCallback(__reqId, __client.Connection); try { __service.GetMails(__client, userId, reply); } catch(ServiceException e) { reply.Error(e.ErrCode, e.Message); } catch(Exception e) { Log.Error("Generic Service Invoke Failed, clientId:{0} error message:{1}\nCall Stack: {2}", __client.ID, e.Message, e.StackTrace); reply.Error((int)ServiceErrorCode.Generic, "generic service error."); } PerfStatistic.AddItem("IMailServer.GetMails", (int)__timer.End()); return null; }
void IMailServerImpl.GetMails(Session session, string userId, IMailServer_GetMailsCallback cb) { var mails = _mailbox.Where(m => m.receiver == userId).Select(m => m.mail).ToArray(); cb.Reply(mails); }