MCPcopy Create free account
hub / github.com/nodejs/node / ondata

Function ondata

test/async-hooks/test-writewrap.js:67–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65}
66
67function ondata() {
68 //
69 // Writing data to client socket
70 //
71 const write = () => {
72 let writeFinished = false;
73 this.write('f'.repeat(1280000), () => {
74 writeFinished = true;
75 });
76 process.nextTick(() => {
77 if (writeFinished) {
78 // Synchronous finish, write more data immediately.
79 writeFinished = false;
80 write();
81 } else {
82 // Asynchronous write; this is what we are here for.
83 onafterwrite(this);
84 }
85 });
86 };
87 write();
88}
89
90function onafterwrite(self) {
91 checkDestroyedWriteWraps(1, 'client destroyed');

Callers

nothing calls this directly

Calls 1

writeFunction · 0.70

Tested by

no test coverage detected