@@ -41,6 +41,8 @@ class Message_base : public object_base
4141 virtual result_t readAll (obj_ptr<Buffer_base>& retVal, AsyncEvent* ac) = 0;
4242 virtual result_t write (Buffer_base* data, AsyncEvent* ac) = 0;
4343 virtual result_t get_length (int64_t & retVal) = 0;
44+ virtual result_t end () = 0;
45+ virtual result_t isEnded (bool & retVal) = 0;
4446 virtual result_t clear () = 0;
4547 virtual result_t sendTo (Stream_base* stm, AsyncEvent* ac) = 0;
4648 virtual result_t readFrom (Stream_base* stm, AsyncEvent* ac) = 0;
@@ -67,6 +69,8 @@ class Message_base : public object_base
6769 static void s_readAll (const v8::FunctionCallbackInfo<v8::Value>& args);
6870 static void s_write (const v8::FunctionCallbackInfo<v8::Value>& args);
6971 static void s_get_length (v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value> &args);
72+ static void s_end (const v8::FunctionCallbackInfo<v8::Value>& args);
73+ static void s_isEnded (const v8::FunctionCallbackInfo<v8::Value>& args);
7074 static void s_clear (const v8::FunctionCallbackInfo<v8::Value>& args);
7175 static void s_sendTo (const v8::FunctionCallbackInfo<v8::Value>& args);
7276 static void s_readFrom (const v8::FunctionCallbackInfo<v8::Value>& args);
@@ -99,6 +103,8 @@ namespace fibjs
99103 {" read" , s_read, false },
100104 {" readAll" , s_readAll, false },
101105 {" write" , s_write, false },
106+ {" end" , s_end, false },
107+ {" isEnded" , s_isEnded, false },
102108 {" clear" , s_clear, false },
103109 {" sendTo" , s_sendTo, false },
104110 {" readFrom" , s_readFrom, false }
@@ -306,6 +312,32 @@ namespace fibjs
306312 METHOD_RETURN ();
307313 }
308314
315+ inline void Message_base::s_end (const v8::FunctionCallbackInfo<v8::Value>& args)
316+ {
317+ METHOD_INSTANCE (Message_base);
318+ METHOD_ENTER ();
319+
320+ METHOD_OVER (0 , 0 );
321+
322+ hr = pInst->end ();
323+
324+ METHOD_VOID ();
325+ }
326+
327+ inline void Message_base::s_isEnded (const v8::FunctionCallbackInfo<v8::Value>& args)
328+ {
329+ bool vr;
330+
331+ METHOD_INSTANCE (Message_base);
332+ METHOD_ENTER ();
333+
334+ METHOD_OVER (0 , 0 );
335+
336+ hr = pInst->isEnded (vr);
337+
338+ METHOD_RETURN ();
339+ }
340+
309341 inline void Message_base::s_clear (const v8::FunctionCallbackInfo<v8::Value>& args)
310342 {
311343 METHOD_INSTANCE (Message_base);
0 commit comments